Why is magnesium atom smaller than atoms of both sodium and calcium?

The location of the outer electrons for Mg are in closer to the nucleus than of Sodium or Calcium.

To add to the correct answer from Bob Pursley, consider the electronic configurations.
11Na = 1s2, 2s2, 2p6, 3s1
12Mg = 1s2, 2s2, 2p6, 3s2
20Ca = 1s2, 2s2, 2p6, 3s2, 3p6, 4s2

The outer electron for Na "sees" a charge of +1 (11 protons in the nucleus shielded by 10 electrons from the inner shells) whereas the outer electrons for Mg "see" a +2 charge (12 protons in the nucleus shielded by 10 electrons from the inner shells). Thus the Mg electrons are drawn in further due to the increased charge.
For Ca, the outer electrons see a +2 charge, the same as Mg, (20 protons in the nucleus shielded by 18 electrons from the inner shells) BUT the outer electrons are further out(in the 4s shell instead of the 3s) and the attraction falls off because of the distance.

thanks