This is a slight distortion, or even a merging of two linked ideas and exhortations. The original advice and the common suggestion is "lie back and think of England".

Allegedly, Queen Victoria gave this instruction to her daughter on her wedding night, but it's more usually thought of as a general suggestion to new upper class Victorian brides who were brought up in ignorance and innocence and were not expected to have a clue about the delights of the bridal suite in their pretty little heads.

The supplement encouragement is
"Whatever happens, remember it happened to the Queen."
As in, "It may be disgusting, but it's perfectly normal. Just relax. The world won't end. Really, darling. Look, the Queen did it at least several times, so it's definitely the thing to do. Honest. Sorry we didn't tell you the details, but, buck up old thing."

This was intended as reassurance for times of surprise and trial, though thinking of the Queen (whether Elizabeth or Victoria) at any moment is a guaranteed passion-killer. i doubt it inspired many.

The best use of the phrase has to be in a Billy Bragg's song "Greetings to the New Brunette":
How can you lie back and think of England
When you don't even know who's in the team?