Mg electronic configuration - [Ne] 3s2, 2+ charge - 2 Electrons removed, Mg2+ configuration - [Ne] - 1s2 2s2 2p6
Be is directly above Mg in the periodic table, meaning Be has its valence electrons in the 3s orbital rather than the 2s. 3s orbitals are easier to ionise due to being held at a greater radius from the nucleus and thus being attracted by lower electrostatic attraction. competing against this is the higher nuclear charge (Z) of the nucleus, however as there is an extra level of shielding of the 2s and 2p electrons between the 3s electrons and the nucleus this is accounted for.