Differences in size of an ionic lattice are directly linked to differences in how exothermic the lattice enthalpy of a salt is.
Mg2+ has a smaller radius than Ca2+ and thus a higher positive charge density.
This results in a stronger affinity for the negative O2- ions.