Unknown; perhaps from an African language (possibly Yoruba ófé (“to evade, disappear”)). Pig Latin for foe, though popularly posited, is probably not accurate.
A possible point of origin is Cab Calloway's Hepster's Dictionary, where the word is defined as "Policeman or law enforcement, 'The Man'".