Why do divalent cations form?

The formation of an ionic solid (MX) can be broken into the steps shown below. 
All steps except for the gain of the electron to form the anion and the bringing together of the gas phase ions are endothermic.

Thus it is the formation of the lattice through bringing together the ions (not the electron transfer between the atoms) that drives formation of ionic solids from their elements.

 
   metal  + nonmetal    
endothermic  (1) sublimation   (2) covalent bond
breaking
endothermic 
   gas phase atoms   
 endothermic (1st)
endothermic (2nd)
(3) electron loss    (3) electron gain  exothermic (1st)
endothermic (2nd)
   gas phase ions   
  form lattice (4) exothermic  
   
The ion formation steps are even more endothermic for MX solids where M2+ and X2– ions are involved,

BUT increased exothermicity of the step where the more highly charged ions come together to form compensates for this for Group 2 elements, and the Group 2 elements form divalent ions.

The energy released when divalent ions come together to form MgO is much greater (-3800 kJ mol–1) than when monovalent ions come together to form NaCl (788 kJ mol–1).