Note: The origins of a phrase may sometimes be unknown. While it's not the case for every expression, in cases that it happens, what I'll usually do is list the popular or plausible theories that try to determine where a phrase came from. Keep in mind, though, that these are merely theories, and are not a 100% confirmation.
Additionally, the quotes you see often times come from old books, poems, newspapers, and so on. These quotes are used to give you an idea on how old some of these idioms are. So if there's a quote from a newspaper that uses an expression in 1900, for example, then the expression is at least that old.
Being in a dilemma where the only two available options are both unsatisfying or bad.
The origin of this phrase is believed to be from the United States. According to The Phrase
Finder, the earliest known citation of this idiom being used is from the year 1921, in the Dialect
Notes V where it reads:
"To be between a rock and a hard place . . . To be bankrupt. Common in Arizona in recent panics;
sporadic in California."
Based on this quote, it seems this expression meant 'to be bankrupt' which differs from the 'being in a dilemma' meaning it has today. The earliest I could find this saying in writing with its modern meaning comes from The Advertiser newspaper, 1930, where it's written:
"After that we were between a rock and a hard place. There was a lot of unpleasantness with Mr.
Romanes, but by and by we see'd we couldn't do nothing by fighting each other, so we shared
out the grub, and took what we each thought was the best road off . . . mantelpiece."
* Mariah found herself stuck between a rock and a hard spot when she received a big dent in her car; she either had to spend the money to have it repaired, or drive around with an unsightly dent on her vehicle.