British Prime Minister Keir Starmer handed Trump a letter from Charles during a press conference with reporters at the White House. Trump immediately accepted the invitation.
"This is really special. This has never happened before. This is unprecedented," Starmer told Trump as he handed him the letter.
"The answer is yes," Trump responded, telling Starmer that he would attend with first lady Melania Trump.
"We look forward to being there and honouring the king, honouring the country."
No date for the visit was announced.
The late Queen Elizabeth welcomed Trump for a three-day state visit in June 2019 during his first term in office, during which he had attended an opulent state banquet and a private lunch with the sovereign, as well as having tea with Charles, who was then heir.
That visit already put Trump in a select group of US presidents, as only Barack Obama and George W Bush were afforded official state visits to Britain during Elizabeth's record 70 years on the throne.
It would also turn out to be the last of the more than 110 she hosted during her reign before her death in September 2022.
The visit was not the only occasion when Trump met Elizabeth. He was also invited to tea at Windsor Castle during a trip to Britain in 2018, when he was widely seen to have broken royal protocol by failing to bow to the queen and then walking in front of her as they inspected a military guard.
Both his visits to Britain also attracted large protests, with his 2018 trip costing police more than 14 million pounds ($A28 million) as 10,000 officers were deployed from all over Britain.