We consider the XXZ spin chain with a magnetic field gradient and study the profiles of the magnetization as well as the entanglement entropy. For a slowly varying field it is shown that, by means of a local density approximation, the ground-state magnetization profile can be obtained with standard Bethe ansatz techniques. Furthermore, it is argued that the low-energy description of the theory is given by a Luttinger liquid with slowly varying parameters. This allows us to obtain a very good approximation of the entanglement profile using a recently introduced technique of conformal field theory in curved spacetime. Finally, the front dynamics is also studied after the gradient field has been switched off, following arguments of generalized hydrodynamics for integrable systems. While for the XX chain the hydrodynamic solution can be found analytically, the XXZ case appears to be more complicated and the magnetization profiles are recovered only around the edge of the front via an approximate numerical solution.