Almost all the elements combine to form compounds, although the reactivity may vary from element to element. These combinations take place because almost all the elements are unstable. This instability is a function of the number of electrons in the outermost shell. If the outermost shell is not completely filled with electrons, the element has one of the three options: gaining electrons, losing electrons or sharing electrons.
By gaining or losing electrons, ionic compounds are produced. Sharing of electrons results in the formation of covalent compounds. For example, a sodium atom (Chemical symbol: Na) has 1 electron in its outermost shell, whereas a chlorine atom (chemical symbol: Cl) has 7 electrons in its outermost shell. Both sodium and chlorine are unstable and combine through electron donation from the sodium atom to the chlorine atom, thus achieving a full filled outermost electron shell for both the atoms. Similarly, a water molecule is formed from hydrogen and oxygen atoms. One can think of a large number of chemical compounds that are formed as a result of the combination of elements.
Hope this helps.