Question: what is the importance of magnetic field?
Answer: The Earth's magnetic field serves to deflect most of the solar wind, whose charged particles would otherwise strip away the ozone layer that protects the Earth from harmful ultraviolet radiation. One stripping mechanism is for gas to be caught in bubbles of magnetic field, which are ripped off by solar winds.