Every warm body emits electromagnetic radiation.
In general, the warmer the emitter, the shorter the wavelength of the radiation. Since the Earth's atmosphere is largely transparent to solar radiation, the Sun's rays warm the surface of the Earth which in turn emits in the longer wavelength infrared band. The atmosphere contains gases that absorb and re-emit radiation, thereby pushing the Earth's equilibrium temperature to a warmer value than it would have without an atmosphere. This phenemenon, somewhat inaccurately called the greenhouse effect, depends upon the concentration of water vapor, carbon dioxide, methane and other gases in the atmosphere.