Well another way to put it is that all atoms want to be like noble gases b/c they are most stable. In order to be like a noble gas Mg can easily lose 2 electrons which will put it in the noble gas zone.
But since it's in a very stable state with a filled octet like noble gases it doesn't want to give up electrons which is why the third ionization energy is significantly higher rather than slightly higher than the second ionization energy.
I think I explained it decent enough. Correct me if I'm wrong guys.