Galaxies are ecosystems consisting of dark matter, stars and gas. It is useful to split the gas into three broad components according to its relation to the galaxy. The first is the interstellar medium (ISM), which is the gas that is directly associated with the galaxy. The second is the halo gas, which is distributed outside the galaxy but inside the host dark matter halo of the galaxy. The third is the gas that is not associated with dark matter halos. The latter two components combined are known as the intergalactic medium (IGM). During the formation and evolution of a galaxy, the ISM and IGM interact actively with each other. Halo gas can cool and be accreted into the galaxy to become part of the ISM. The gas in the ISM can be ejected into the halo or even into the large-scale environment by galactic winds and stripping. And finally, dark matter halos can accrete gas from the IGM in their large-scale environments.
Clearly, the IGM is a crucial ingredient of any theory of galaxy formation and evolution. In fact, by definition, all baryons were part of the IGM at sufficiently early times (before the formation of stars and galaxies). At later times, more and more material of the IGM is accreted by virialized dark matter halos, where it can be converted into cold gas (ISM) or stars. However, even at the present day, a very substantial fraction of the baryons is believed to still reside in the IGM.