Ionic compounds are formed when metals transfer electrons to non-metals, resulting in the formation of positively charged cations and negatively charged anions that are held together by strong electrostatic forces. These compounds typically have high melting and boiling points and conduct electricity when dissolved in water or molten due to the mobility of ions.