Ionic bonding occurs between metals and non-metals due to transfer of electrons. The non-metals gain electrons from the metals, giving the non-metals a negative charge and the metals a positive charge, resulting in strong electrostatic forces of attraction between the positively charged metal ions and the negatively charged non-metal ions. Therefore, a large amount of energy is required to break the strong forces between ions.
If we look at the structure for sodium chloride, we know that sodium gives up an electron to become positively charged and chlorine gains this electron to be negatively charged. Thus, the crystal lattice of sodium chloride looks like this:
The positive and negative ions are packed together in a regular arrangement with each negative charge (green sphere) surrounded by positive charges (grey sphere), and vice versa. Thus, there are strong electrostatic forces of attraction between the negative and positive ions, which require high amounts of energy to break apart in order to change their state from solid to liquid (melting) and from liquid to gas (boiling). Hence, ionic compounds have high melting and boiling points.