From the Dictionary of Nautical, University, Gypsy and Other Vulgar Tongues first published in 1859.
On the Fly: getting one’s living by thieving or other illegitimate means; the phrase is applied to men the same as On the Loose is to women.
(I’ve always enjoyed On the Fly. It’s very visual and gives a great sense of movement. The meaning has definitely changed though. I found three different uses for the phrase in modern parlance, none of which have to do with illegal activities:
On the fly: done while something or someone is operating or moving. “I’ll try to capture the data on the fly. Please try to buy some aspirin somewhere on the fly today”
On the fly: (American) if someone does something on the fly, they do it quickly and without thinking carefully before they do it. “She was the sort of person who would make decisions on the fly”
On the fly: in a hurry. “You can’t make this dinner on the fly, you need a whole day.”)