In difficulty, between two dangerous alternatives.
The phrase was originally 'Between the Devil and the deep sea'. The sea turned blue much later and the phrase became well-known via the title of a popular song. Between the Devil and the Deep Blue Sea was written by Ted Koehler and Harold Arlen, and recorded by Cab Calloway in 1931, although that version of the phrase may have been circulating earlier.
What's the source of the original phrase? Well, we would really like to know. CANOE, the Committee to Ascribe a Nautical Origin to Everything, would have us believe that it has a nautical origin (well, they would wouldn't they?). In her book, 'When a loose cannon flogs a dead horse there's the devil to pay', Olivia Isil unambiguously attributes a nautical origin to the phrase.
Set against that there's the explanation that this is from the usual meaning of Devil, i.e. the supreme spirit of evil. If it's that Devil we are talking about then the origin is straightforward - the Devil is bad and falling in the deep sea is bad, so when caught between the two we would be in difficulty.
People who like that explanation can point back to Greek mythology for an earlier version of the idea of being caught between evil and the sea. Homer's Odyssey refers to Odysseus being caught between Scylla (a six-headed monster) and Charybdis (a whirlpool).
To explain the nautical theory we'll need to define some sailing terminology. That's always dangerous ground for landlubbers and usually results in some horny-handed sailing type writing in to say that we don't know our scuppers from our square-knots, but here goes anyway...
"Devil - the seam which margins the waterways on a ship's hull".
This definition is from Henry Smyth's Sailor's Word-Book: An Alphabetical Digest of Nautical Terms, 1867. That definition wasn't entirely clear to me, but a correspondent who describes himself as 'an engineer and vessel constructor', clarified it this way:
"Devil - the seam between the deck planking and the topmost plank of the ship's side".
This seam would need to be watertight and would need filling (caulking) from time to time. On a ship at sea this would presumably require a sailor to be suspended over the side, or at least stand at the very edge of the deck. Either way it is easy to see how that might be described as 'between the devil and the deep sea'.
Incidentally, another term for filling a seam is paying. Those that like nautical origins also give this as the source for the Devil to pay, although the evidence is against them on that one.
The first recorded citation of 'the Devil and the deep sea' in print is in Robert Monro's His expedition with the worthy Scots regiment called Mac-keyes, 1637:
"I, with my partie, did lie on our poste, as betwixt the devill and the deep sea."
The seafaring theory is plausible at least, but does it really hold water? Two factors count against it. Firstly, it doesn't really explain the meaning. The devil on a ship isn't inherently dangerous. Secondly, does the phrase pre-date the nautical term 'devil'? We've no evidence to show the word in that context until over two hundred years after the first sighting of the phrase.
CANOE don't quite convince with this one. On balance it seems wise to stay on dry land and stick with the Devil we know.