Inherited from Old French oie, from earlier oe, oue, from Vulgar Latin auca, contraction of *avica, from Latin avis (“bird”). Compare Italian, Spanish, and Catalan oca, Franco-Provençal ôye, Occitan and Romansch auca, Friulian ocje.
The Trésor de la langue française argues that -i- was added by the end of the 12th century as analogy to oisel, oiseau (“bird”).