  The characteristic mass that sets the peak of the stellar initial mass
function (IMF) is closely linked to the thermodynamic behaviour of interstellar
gas, which controls how gas fragments as it collapses under gravity. As the
Universe has grown in metal abundance over cosmic time, this thermodynamic
behaviour has evolved from a primordial regime dominated by the competition
between compressional heating and molecular hydrogen cooling to a modern regime
where the dominant process in dense gas is protostellar radiation feedback,
transmitted to the gas by dust-gas collisions. In this paper we map out the
primordial-to-modern transition by constructing a model for the thermodynamics
of collapsing, dusty gas clouds at a wide range of metallicities. We show the
transition from the primordial regime to the modern regime begins at
metallicity $Z\sim 10^{-4} \rm{Z_\odot}$, passes through an intermediate stage
where metal line cooling is dominant at $Z \sim 10^{-3}\,\rm{Z_{\odot}}$, and
then transitions to the modern dust- and feedback-dominated regime at $Z\sim
10^{-2} \rm{Z_\odot}$. In low pressure environments like the Milky Way, this
transition is accompanied by a dramatic change in the characteristic stellar
mass, from $\sim 50\,\rm{M_\odot}$ at $Z \sim 10^{-6}\,\rm{Z_{\odot}}$ to $\sim
0.3\,\rm{M_\odot}$ once radiation feedback begins to dominate, which marks the
appearance of the modern bottom-heavy Milky Way IMF. In the high pressure
environments typical of massive elliptical galaxies, the characteristic mass
for the modern, dust-dominated regime falls to $\sim 0.1\,\rm{M_{\odot}}$, thus
providing an explanation for the more bottom-heavy IMF observed in these
galaxies. We conclude that metallicity is a key driver of variations in the
characteristic stellar mass, and by extension, the IMF.
