  The formation of stars and planetary systems is a complex phenomenon, which
relies on the interplay of multiple physical processes. Nonetheless, it
represents a crucial stage for our understanding of the Universe, and in
particular of the conditions leading to the formation of key molecules (e.g.
water) on comets and planets. Herschel observations demonstrated that stars
form out of gaseous filamentary structures in which the main constituent is
molecular hydrogen (H$_2$). Depending on its nuclear spin H$_2$ can be found in
two forms: `ortho' with parallel spins and `para' where the spins are
anti-parallel. The relative ratio among these isomers, i.e. the ortho-to-para
ratio (OPR), plays a crucial role in a variety of processes related to the
thermodynamics of star-forming gas and to the fundamental chemistry affecting
the deuteration of water in molecular clouds, commonly used to determine the
origin of water in Solar System's bodies. Here, for the first time, we assess
the evolution of the OPR starting from the warm neutral medium, by means of
state-of-the-art three-dimensional magneto-hydrodynamic simulations of
turbulent molecular clouds. Our results show that star-forming clouds exhibit a
low OPR ($\ll 0.1$) already at moderate densities ($\sim$1000 cm$^{-3}$). We
also constrain the cosmic rays ionisation rate, finding that $10^{-16}\,\rm
s^{-1}$ is the lower limit required to explain the observations of diffuse
clouds. Our results represent a step forward in the understanding of the star
and planet formation process providing a robust determination of the chemical
initial conditions for both theoretical and observational studies.
