The US president will visit the UK from June 3-5, taking part in a series of engagements with the Prime Minister as she prepares to leave Number 10.
After months of intense pressure over the failure of her Brexit strategy, Mrs May finally announced that she would quit as Conservative leader on June 7, triggering a leadership contest.
The Prime Minister's official spokesman said she was still looking forward to hosting Mr Trump.
After Mrs May announced the timetable for her departure, Mr Trump said: "I feel badly for Theresa.
"I like her very much. She is a good woman. She worked very hard.
"She is very strong."
Meanwhile, a survey found that the controversial president's state visit is backed by a majority of Britons even though fewer people think the Government should work with him, a survey has found.
There were huge protests when Mr Trump made a working visit to Britain last year and more are expected when he arrives for the higher profile three-day state occasion.
But the YouGov poll found that 46% of those surveyed think the state visit should go ahead, while 40% want it to be cancelled.
Before Mr Trump's trip last year, YouGov found 50% backed it while 37% did not want him to come.
YouGov questioned 2,108 adults on May 19-20 and found an increase in the number of Britons who think the Queen should meet Mr Trump.
Last year, for the working trip, Britons thought the Queen should keep her distance, by 49% to 35%, while the figures for the state visit she is hosting are 42% and 41% respectively.
There has been a drop over the last two years in the number who feel the Government should try to work with Mr Trump.
In January 2017, 51% said ministers should work with the US president and only 32% felt they should keep their distance, while the figures are now 40% and 41%.
Mr Trump and his wife Melania will be welcomed by the Queen, joined by the Prince of Wales and Duchess of Cornwall, in the garden at Buckingham Palace on June 3.
The Duke of Sussex will be at the private palace lunch held on the first day for the Trumps but wife Meghan, whose son Archie will be less than four weeks old when the president arrives, will not.
At the state banquet, a lavish white-tie dinner staged in the palace's ballroom, the Duke and Duchess of Cambridge will join the Queen, Charles and Camilla for the event, which will feature leading figures from UK national life and prominent Americans in Britain.
The US president will also have tea with the heir to the throne and his wife during the first day, and on the second will visit Downing Street for talks with the Prime Minister.
Mr Trump will reportedly be bringing his grown-up children with him - daughter Ivanka and her husband Jared Kushner, both advisers to the president, along with her siblings, Tiffany Trump, Donald Trump Jr and Eric Trump.
During the second day of the state visit, Mrs May and the US president will co-host a business breakfast meeting, attended by the Duke of York, at St James's Palace.
Mr Trump will then visit Downing Street to hold talks with the Prime Minister, followed by a joint press conference.
That evening the Trumps will host a return dinner at Winfield House, the residence of the US Ambassador, which Charles and Camilla will attend on behalf of the Queen.
On Wednesday June 5, the Queen and Charles will attend the national commemorative event for the 75th anniversary of the D-Day landings at Southsea Common, Portsmouth.
More than 300 D-Day veterans will be at the ceremony, which aims to tell the story of D-Day through musical performance, testimonial readings and military displays, including a fly-past of 25 modern and historical aircraft.