The 86-year-old monarch, who rarely misses a public engagement, is suffering from gastroenteritis, a Buckingham Palace spokesperson said.
However, her condition is not believed to be serious.
The Queen had been due to present members of the 3rd Battalion � The Royal Welsh with leeks to mark St David's Day during her visit to Swansea today.
She will now spend the weekend recuperating at Windsor Castle and her condition will be assessed in the coming days as she is also due to travel to Italy next week.
More From This Section
As well as a formal ceremonial welcome and a private lunch, the Queen is also due to visit the Pantheon, the ancient Roman monument where two Italian kings are buried.
The ceremony in Swansea, including a parade to Swansea's Guildhall, is set to go ahead without the Queen.
"The ceremony will continue as planned and will be carried out by the Lord Lieutenant of West Glamorgan, Mr Byron Lewis," a council spokesperson confirmed.
Today's celebrations are part of a series of events being held in honour of the patron saint of Wales, St David.
She last cancelled an event in October 2012, when she had to miss an investiture ceremony at Windsor Castle due to chronic back pain.
In 2011, she pulled out of a visit to the British Museum because of a cold, and a tour of Arsenal's new stadium in 2006 was cancelled after she strained her back.
Her last major public appearance was on Thursday, when she presented Olympic athletes with honours in an investiture ceremony at Buckingham Palace. The recipients included Britain's 2012 Olympic winners Jessica Ennis and Nicola Adams.