In general if we let $X=g(U,V), Y=h(U, V)$ (and assuming this is a one-to-one coordinate transfer) we can use the Jacobian formula:
$$\begin{align}f_{U,V}(u,v)=&~ \Big\lvert\dfrac{\partial (x,y)}{\partial (u,v)}\Big\rvert\,f_{X,Y}(x,y) \\[1ex] =&~ \Big\lvert\dfrac{\partial (g(u,v), h(u,v))}{\partial (u,v)}\Big\rvert\,f_{X,Y}(g(u,v), h(u,v))\end{align}$$
Where $\dfrac{\partial (x,y)}{\partial (u,v)}$ is shorthand for the determinant of the Jacobian matrix $$\Big\lvert\dfrac{\partial (x,y)}{\partial (u,v)}\Big\rvert=\begin{Vmatrix}\partial x/\partial u & \partial x/\partial v \\ \partial y/\partial u & \partial y/\partial v \end{Vmatrix}$$
In this specific case we take $U=X, V= XY$ (or $Z$), so $X=U, Y=V/U$ (or $Z/X$) ... and also $f_{X,Y}(x,y) = f(x)\,f(y)$ due to being independent and identically distributed
$$\begin{align}f_{X,Z}(x,z) =&~ \Big\lvert\dfrac{\partial (x,z/x)}{\partial (x,z)}\Big\rvert\,f(x)\,f(z/x)\\[1ex] =&~ \begin{Vmatrix}\partial x/\partial x & \partial x/\partial z \\ \partial (z/x)/\partial x & \partial (z/x)/\partial z \end{Vmatrix}\,f(x)\,f(z/x)\\[1ex] =&~ \begin{Vmatrix}1 & 0 \\ -z/x^2 & 1/x \end{Vmatrix}\,f(x)\,f(z/x)\\[1ex] =&~ \lvert \tfrac 1 x \rvert\,f(x)\,f(z/x)\end{align}$$
And hence the marginal is $\displaystyle f_{XY}(z) = \int_\Bbb R \lvert \tfrac 1 x \rvert,f(x),f(z/x)\operatorname d x$