The formation of a cold and dense gas phase in the interstellar medium (ISM) of galaxies is key for gravitational-collapse and star-formation. From a theoretical point of view, the thermal balance between gas heating and cooling naturally results in a multiphased ISM, composed of warm-diffuse (n ~ 0.5 cm-3, T ~ 104 K) and cold-dense (n ~ 50 cm-3, T ~ 100 K) phases. 21 cm observations in the Galaxy and in nearby galaxies indeed point to a multiphase warm/cold ISM. How do the ISM phases evolve with cosmological time and across galactic environments? I will present our recent theoretical model (Bialy & Sternberg 2019) for the thermal phase structure of the ISM in various galactic environments: From solar to low metallicity, applying for dwarf galaxies and high redshift galaxies, and at various UV and cosmic-ray intensities, applying to normal versus starburst galaxies. I will emphasize the importance of the formation of molecular hydrogen (not only as a coolant, but also as a heating agent), which at low metallicity does not allow a multiphase medium, and results in a smooth single-phased ISM. I will discuss implications to star-formation and recent development of an improved multiphased-ISM model (Bialy, Diemer & Hernquist; in prep) for future large volume cosmological simulations.