Magnetic fields can help protect atmospheres
Earth’s magnetic field pushes away much of the solar wind, helping protect the atmosphere and ozone layer. Mars lost almost all of its atmosphere after its magnetic field faded and the solar wind was able to carry charged particles away.