The Duke of Edinburgh has been admitted to hospital as a "precautionary measure" for treatment of an infection arising from a pre-existing condition, Buckingham Palace said.
Philip was supposed to be accompanying the Queen to the State Opening of parliament on Wednesday but his place has been taken by the Prince of Wales.
A Buckingham Palace spokesman said: "The Duke of Edinburgh was admitted to King Edward VII Hospital in London last night, as a precautionary measure, for treatment of an infection arising from a pre-existing condition.
"Prince Philip is in good spirits and is disappointed to be missing the State Opening of Parliament and Royal Ascot.
"The Prince of Wales will accompany the Queen to the State Opening.
"Her Majesty is being kept informed and will attend Royal Ascot as planned this afternoon."
The Duke was at the Queen's side on Tuesday for the opening day of Royal Ascot and seemed in good spirits.
He has enjoyed good health throughout much of his life, recovering from a blocked coronary artery in 2011 and a bladder infection in 2012, the latter leading him to miss the majority of the Queen's Diamond Jubilee celebrations.
His decision to retire from public duties after the summer was not health-related, Buckingham Palace said at the time of the announcement earlier this year.
The Duke is an advocate of healthy eating combined with exercise. He once said he more or less followed the Atkins diet and he drinks only moderately.
He takes the stairs rather than lifts and still fits into the uniform he wore on his wedding day.
He is well-known for his robust constitution. He told a flu expert at a research centre last year that he had not had the illness for 40 years.
It is understood the Duke was not admitted as an emergency but, on the advice of a doctor, was driven from Windsor Castle to hospital in London on Tuesday evening.
Buckingham Palace would not go into details of Philip's condition or the type of infection but his past history of a bladder infection could indicate his current problem.
He was reported to have been up and about on Wednesday morning, indicating the medical issue is not serious enough to leave him bed-bound.
He was said by a source to be on "good form" at Royal Ascot on Tuesday when he and the Queen were joined by many members of their family, including Charles and Camilla, the Duke and Duchess of Cambridge, the Duke of York and the Earl and Countess of Wessex.
It is not known how long Philip will be kept in hospital but it could be a few days to allow any treatment to take effect.