Literally: to be in between pretty sheets.
Meaning: Be in a right mess, be up the creek without a paddle; to be in a pickle.
Origins: From the Antiquity to the Middle Ages, “les draps” were synonymous of the clothing. First it was “etre dans de beaux draps blancs” (to be in between pretty white sheets) meaning being in a bad way, sometimes to designate adulterers. Those had to go to mass in white clothes so everybody would knew their sins. The white also reminds of the shroud, an analogy to the bad situation, as bad as death.
In addition, during the Middle Ages, in theaters, there was often a character dressed in white clothes, his role was simple: He had to stand while the spectators would insult him, so they would feel part of the show.
In the 17th century, it meant to be the center of critics, or mockery. The adjective white disappeared later on. The meaning stayed the same and evocates a delicate situation.
Today, we can also say: “etre dans de sales draps” /"to be in dirty sheets"; but then, it loses a bit of the sarcasm.