Zinc oxide is an ionic compound, Zn2+, and oxide anions, O2‒. When uncharged zinc and oxygen atoms react to form zinc oxide, electrons are transferred from the zinc atoms to the oxygen atoms to form these ions. 
In this transfer of electrons from metal atoms to nonmetal atoms is the general process for the formation of any binary ionic compound from its elements.