They share electrons.
Did you mean, "How does a covalent compound form"?
Covalent compounds share their electrons.
As you might know, hydrogen wants to get 1 electron, and oxygen wants to lose 2 electrons.
Then, oxygen shares its electrons one each with hydrogen.
Here are some other covalent compounds.
You might be confused between covalent and ionic compounds.
Just remember that covalent compounds share electrons, and ionic compounds give/take electrons.
For more information, I recommend to watch some videos.