Na and Mg belong to the same period with Na having 1 electron in valence shell which is M shell. Mg has the same valence shell but has 2 electrons in it.
The higher number of protons in Mg pulls the electrons towards the nucleus and decreases the atomic size of the Mg atom.
Atomic size decreases on moving left to right across a period and as Mg lies to the right of Na it has a smaller atomic size.