Oxygen is a second period element. This places restrictions on its bonding, because it can only use the s and p orbitals from the second shell in bonding. These orbitals can only hold 8 electrons. Since oxygen already has 6, covalent bonding with 2 fluorine atoms will give it 8.