The main property of ionic compounds which affects melting point is the strength of the ionic bonds.
Sodium is a Group I (or IA) representative element which means it will form a cation of +1 charge. Chlorine is a Group XVII (or VIIA) representative element indicating it will form an anion of -1 charge. This means the electrostatic attraction between the two ions is determined by Coulomb's law and is proportional a single positive and negative charge.
Magnesium is a Group II (IIA) element meaning it produces a +2 charge and oxygen is a Group XVI (VIA) element producing a -2 ion. Coulombs law predicts this will have a force of electrostatic attraction that is based on a +2 and -2 charge which is 4 times greater than that of NaCl.