The infection arose from “a pre-existing condition”, the palace said.
The Duke of Edinburgh, who is to retire from public duties later this year, was admitted to King Edward VII Hospital in London on Tuesday night.
Prince Philip was due to accompany the monarch to the state opening of parliament on Wednesday as well as the Royal Ascot horse races.