Found in Greek borrowings into Latin, representing Greek -oi-. Words with -oe- that came early into English from Old French or Medieval Latin usually already had been levelled to -e- (e.g. economic, penal, cemetery), but later borrowings directly from Latin or Greek tended to retain it at first (oestrus, diarrhoea, amoeba) as did proper names (Oedipus, Phoebe, Phoenix) and purely technical terms. British English tends to be more conservative with it than American, which has done away with it in all but a few instances.
It also occurred in some native Latin words (foedus "treaty, league, " foetere "to stink, " hence occasionally in English foetid, foederal, which was the form in the original publications of the "Federalist" papers). In these it represents an ancient -oi- in Old Latin (e.g. Old Latin oino, Classical Latin unus), which apparently passed through an -oe- form before being levelled out but was preserved into Classical Latin in certain words, especially those belonging to the realms of law (e.g. foedus) and religion, which, along with the vocabulary of sailors, are the most conservative branches of any language in any time, through a need for precision, immediate comprehension, demonstration of learning, or superstition. But in foetus it was an unetymological spelling in Latin that was picked up in English and formed the predominant spelling of fetus into the early 20c.