Ozone formation occurs primarily in the stratosphere through the interaction of ultraviolet (UV) radiation with molecular oxygen, leading to the creation of ozone molecules. This process plays a crucial role in absorbing harmful UV radiation, protecting living organisms on Earth from its damaging effects.