First ionization enthalpy of Mg is greater than that of Ca because:
Mg ,Atomic Number= 12 ( 2,8,2)
Ca ,Atomic Number= 20 (2,8,8,2)
The valence electrons of calcium are found in the Nth shell and they are being shielded by the K,LandM shells. whereas the valence electrons in magnesium are found in the Mth shell and are being shielded by only K and L shells and hence experience greater attraction to the nucleus and hence require more energy to remove.