The Magnetosphere, as a results of the electromagnetic force, one of the four fundamental forces of the universe, is produced by convection currents in the outer liquid of Earth’s core. Basically, the Earth is like a giant magnet, with its two poles (the magnetic dipole) which differ slightly from the geographic poles.
This magnetic field is preventing the Earth from being blasted by solar winds, a stream of charged particles emanating from the Sun. Mars, as Venus, doesn’t have a magnetosphere. Therefore the planet isn’t protected against the harmful cosmic radiation and suffer a strong atmosphere erosion. The radiation on Mars ranges around 200 mSv/year, which is is 100 time more than Earth’s average!
You can see others illustrations i made for in this project here (in french sorry!)