In covalent bonding, valence electrons are shared between two nonmetal atoms in order to fill both outer shells. Nonmetal atoms usually have nearly-complete outer orbitals, which is why they seek to fill them and become stable by sharing electrons with each other.
Valence electrons are involved in any type of bonding. When nonmetal and metal atoms bond, they typically do so ionically. The metal atom donates one or more of its few valence electrons in order to deplete its outer orbital, while the nonmetal atom accepts electrons to fill its outer orbital. When two nonmetals bond, neither has a significantly greater pull to an electron, which is why valence electrons are shared, rather than transferred.