Melting points, among other things, depend upon lattice energy.
Now NaCl and KCl have unit charge on their ions while MgO and BaO have two units of charge,
therefore, lattice energies of MgO and BaO are expected to be larger than those of NaCl and KCl.
Further since Mg2+ is smaller than Ba2+,
therefore, MgO has the highest lattice energy and hence has the highest melting point.