The short answer
The queen usually named is Queen Anne, who ruled Great Britain from 1702 to 1714. She is commonly said to have been pregnant about 17 times, and none of her children outlived her. The exact count is not certain, since records of early miscarriages and stillbirths from the period are incomplete.
Anne’s pregnancies and her children
Anne married Prince George of Denmark in 1683. Over the following years she had many pregnancies, and most ended in miscarriage, stillbirth or the death of the baby within hours or days. Only one child lived beyond infancy.
The causes are not known with confidence. Historians and doctors have proposed a number of explanations, including various medical conditions, but nothing has been settled, and it is best to treat such diagnoses as speculation.
Prince William, Duke of Gloucester
Her son William, born in 1689, was the one child who survived early childhood. He was in poor health, but was seen as the hope of the Protestant succession. He died in July 1700 at the age of 11. After his death, Anne had no surviving children.
Why it mattered
Anne’s lack of an heir created a crisis. Her father James II had been deposed, and his Catholic descendants were barred from the throne. Parliament passed the Act of Settlement in 1701, which named the Protestant Sophia, Electress of Hanover, and her heirs as next in line after Anne. Sophia died shortly before Anne, so the crown passed in 1714 to Sophia’s son, who became George I.
That decision ended the Stuart line on the throne and began the Hanoverian era. For how rules like this have worked over time, see types of royal succession and the history of royal succession in england.
A note on the numbers
Figures such as “17” appear widely, but sources differ on how many of the pregnancies ended in live births. You may see slightly different counts. It is safe to say that Anne endured a very large number of pregnancies and outlived all her children.