  The physical processes driving the chemical evolution of galaxies in the last
$\sim 11\, \rm{Gyr}$ cannot be understood without directly probing the
dust-obscured phase of star-forming galaxies and active galactic nuclei. This
phase, hidden to optical tracers, represents the bulk of star formation and
black hole accretion activity in galaxies at $1 < z < 3$. Spectroscopic
observations with a cryogenic infrared (IR) observatory like SPICA will be
sensitive enough to peer through the dust-obscured regions of galaxies and
access the rest-frame mid- to far-IR range in galaxies at high-$z$. This
wavelength range contains a unique suite of spectral lines and dust features
that serve as proxies for the abundances of heavy elements and the dust
composition, providing tracers with a feeble response to both extinction and
temperature. In this work, we investigate how SPICA observations could be
exploited to understand key aspects in the chemical evolution of galaxies: the
assembly of nearby galaxies based on the spatial distribution of heavy element
abundances, the global content of metals in galaxies reaching the knee of the
luminosity function up to $z \sim 3$, and the dust composition of galaxies at
high-$z$. Possible synergies with facilities available in the late 2020s are
also discussed.
