According to the octet rule, atoms must bond to each other, sharing electrons among themselves in an attempt to complete their valence shell (last layer of the electrosphere). In other words, an atom becomes stable when it has 8 electrons in its valence shell.
Oxygen atoms have six electrons in their valence shell, so to achieve the stability suggested by the octet rule (eight electrons), these atoms share two electrons, forming one oxygen gas (O₂) molecule.
The inter-molecular forces of attraction between the molecules must have been broken (overcome) before the molecules can gain an increase in the kinetic energies between them.