This originally comes from an old legend about Christ visiting a baker to buy a loaf of bread. The dough that the mistress put in the oven for him was very large, so her daughter tore half of it off. The dough nonetheless rose to a considerable size; the girl's laughter sounded like hooting, and she was transformed into an owl.
The phrase is most familiar through its use by Ophelia in Shakespeare's 'Hamlet'. In Act 4, Scene 5, she has been driven mad by grief and heartbreak, and speaks in riddles. This can be seen in the clip below from Kenneth Branagh's 1996 adaptation, with Kate Winslet as Ophelia.