Because the easier a metal donates an electron (Low Ionization Energy), the more readily a non-metal with high electromagnetically will accept it.
Thus they match well, - one readily donates, the other readily accepts. This is how ionic bonding occurs.
Hope this helps.