The Phrase Finder identifies this as an American expression from the mid-20th century, and refers to a cartoon from the Pennsylvania newspaper The Clearfield Progress in 1938.
Worldwidewords found an earlier citation: “Woodland Daily Democrat of California, dated January 1896: “To use a vulgar expression, a Republican congress gleefully assembled in Washington for the express purpose of getting President Cleveland ‘over a barrel.’ The humiliating predicament…” As often the case, it seems the writer expected his readers to recognise this easily.
The OED suggests that the allusion is to placing a person rescued from drowning over a barrel to clear their lungs of water. This might sound rather unlikely, but there are many references in the literature to show this was once a common practice…
There are instances recorded from this period and earlier of a person being placed on or rolled over a barrel as a humiliating punishment. One case was that of a student hazing at a college in Ohio, reported in the Frederick Daily News in Maryland in 1886: ‘Once inside he was at the mercy of his captors, and the treatment he received was cruel. Bound hand and foot, he was rolled over a barrel.’ This is by far the more likely origin, since a person held over a barrel is helpless, whether face down or face up. It fits the meaning of the phrase much better than the resuscitation one does.