Not all electrons in an atom experience the full pull from the nucleus, with electrons in outer shells observing a weaker pull than those closer to the nucleus. This is due to the fact that the closer electrons nullify the effect of the number of protons equal to their charge.
This means that for a sodium atom, the outer shell would only experience the charge equivalent to one proton as the two previous shells would cut the effect of the nucleus by a total of 10 +ve charges. This effect is the same for all atoms, but when going from sodium to magnesium the number of protons pulling on the outer electrons increases, with each of these electrons feeling a bigger pull from the nucleus decreasing the size of the atom. This explains the decrease in size going along a period.