The Duke of Edinburgh was admitted to hospital on Tuesday as "a precautionary measure" for an infection arising from a pre-existing condition.
Buckingham Palace said Prince Philip was being treated at the King Edward VII Hospital in London and was "up and about and in good spirits".
The duke, 96, said in May that he would retire from royal duties this autumn - a move supported by the Queen.
She is still carrying out her official engagements and on Wednesday delivered the Queen's Speech to Parliament before heading to the racing at Ascot.
In a statement, Buckingham Palace said the Prince of Wales would accompany the Queen to Parliament and Prince Philip was "disappointed" to miss the event.
Prince Charles was asked about the duke while on a visit to the scene of the Finsbury Park mosque attack.
"He's getting better. He's getting better," he told reporters.
The duke was at the Queen's side on Tuesday afternoon for the opening day of the four-day Ascot race meeting.
It is understood he was not admitted to hospital as an emergency but, on a doctor's advice, was driven from Windsor Castle to the central London hospital on Tuesday evening.
How long he will remain there is not yet known.