You should first parametrize the line as $(x,y,z)=p_1+t(p_2-p_1)$, for $t\in\mathbb{R}$. From this, substituting the coordinates of the two points, you get the equations that define this line in $\mathbb{R}^3$ in terms of $x,y,z$.
On the other hand, you can similarly parametrize the prism (if it's a solid volume then it will be defined by inequalities in $x,y,z$).
Then you put both systems together, the equations that define the line and the inequalities that define the prism, and see if it has a solution (if it exists a point that belongs to both line and prism, so it belongs to their intersection).