I don't understand how this ionic bond forms? if you could draw a picture that would help greatly!
The sulfate ion has a net charge of -2, meaning it is deficient in 2 electrons in order to have all 5 atoms have a full octet. Each atom contributes only the valence electrons it has. Since Sulfur has 6, and each Oxygen has 6, there are 5 atoms with 6 electrons. This is a total of 30 electrons. When you draw the Lewis Structure of the sulfate ion, you will see that sulfur has a full octet (eight electrons) around it by the four shared bonds with the four oxygen atoms. So, Sulfur would be in the middle like this:
O ---- S----O
and each dashed line is a shared pair, so it's worth 2 total electrons. That's 8 of the 30. That leaves 22.
If we put 6 around 3 of the oxygens, we'd have 18 more for a total of 26. That means the final O would have four electrons around it for a total of 30 electrons. This means that this particular O has the four free electrons plus the 2 in the bond for a total of 6. But since it want's eight, it will try to find 2 more and that is why it will steal 2 from another source like Magnesium. Magnesium has 2 valence electrons and thus it would rather give those up than get 6 more because it takes less energy; so when it encounters the sulfate ion, it will donate 2 to the oxygen with only four leaving it +2 and the sulfate ion -2. They will then form the ionic compound MgSO4. The program won't let me put drawings in, but I hope that helps.