I have trouble finding anything about this. Google offers several quotes at the top of the results:
- Rowena Cory Daniells, "The King's Bastard", 2016
'You fancy her!' Lence nodded, 'And what's more, I've tasted her sweet fruit.' 'No, you never!' 'Autumn cusp, in the hay after the Harvest Feast.' [...] 'She deserves Better than a fling in the hay, Lence.' 'Well, that's all I can offer, remember?' Lence snapped. 'I'm to be married to the Merofynian kingsdaughter. So, go ahead, woo her, marry her if she'll have you. But one day she will be my mistress.'
- Elizabeth August, "Cinderella Story 3, 2014
"Besides, I like my independence. All I want is a little fling in the hay once in a while to satisfy my more primitive cravings, then I'm happy to be on my own again."
ngram finds nothing though, not even these google-books books.
It's pretty obvious that the saying relates to the "affair" definition of fling. So the preliminary question must be, which was first, is fling in this sense just an ellipsis?
The more current idiom seems to be a roll in the hay, agreeing roughly with the trivial meaning of fling "to throw". There, it's noted that hay can be a synonym for bed, and that roll in the hay can mean inconspicious children's play, frolicking. One has to say had meant, actually, because the the daily live has changed and thus turned the euphemism overt, occluding the once obvious meaning.
Yet, I think I can read an inuendo in 1838
Ingraham, J. H. (Joseph Holt) "Burton; or The Sieges Volume 2]()", 1838
If it had been the spy-monk in thy case, he would not have let a maiden tuck him up in the hay, and leave him there to go to her lone pillow.
I'm trying to read hay as hay field, at least in some older instances of "in the hay", because I first associated German Springinsfeld (lit. jump into the field; It's an appellation, not one of the usual long German compound words, it appears like a speaking name, like Hans Guckindieluft "Johnny Look-at-Air"), although I'm not sure what a "hay field" should be, if long grass becomes hay only after the harvest. Anyhow, there the answer currently says it's military jargon, which needn't be original. As far as I know, "fling in the hay" does not usually describe a person, but it comes rather close e.g. in "All I want is a little fling in the hay".
I'm hoping a quick fling in the hay can elucidate the question. Give me your best shot at the origin of the phrase. Anything far flung is welcome, too, if it can be possibly backed-up with sources.