What happens to the valence electron when an atom forms a covalent bond with another atom
Electron is quantum particle. It means it must obey the Heisenberg principle, saying that you can not tell at the same time the exact position and speed of it. As you have learned, in an atom electrons are arranged in energy levels (each level corresponding to a particular principal quantum number n) and each level of energy is having one or more orbitals s, p, d or f (each orbital corresponding to a particular angular quantum number l=0,...,n-1).
As said before, you need to imagine the trajectory of an electron in a certain orbital, in a certain level of energy, as being more like an cloud of charge of a certain form (you can not tell exactly where the electron is in space) than as a trajectory (like a planet has around a star).
When the valence electrons form a covalent bond, they DE-LOCALIZE from their atom. They begin belonging to both atoms that form the covalent bond. This means that the form of the cloud describing the electron position in the atom change, and extends now over the space of both atoms. It is like when the electron orbit each of two atoms nuclei (but you can not tell exactly where it is in space) and the probability of finding the electron near a certain atom is 0.5.
This is in contrast with the ionic bond, where each atom gives or receives the valence electrons (which transform the atoms into ions) thus forming the ionic bond. In this case, the form of the electric clouds describing the electrons trajectory does not change at all and literary the electrons stay close to the atoms nuclei. It is said they belong only to a single atom.