The two leaders met at Chequers in Buckinghamshire. (Images: PA).
Donald Trump has described the relationship between the UK and the US Armed Forces as "vital".
The US President was speaking at a joint news conference with Theresa May at Chequers, the country residence of the Prime Minister.
Earlier the two leaders watched a counter-terrorism exercise involving UK and US Special Forces at the Royal Military Academy Sandhurst.
"The United Kingdom and the United States are also strengthening cooperation between our Armed Forces who serve together on battlefields all around the world," said President Trump during the press conference.
"Today the Prime Minister and I viewed several US-UK Special Forces demonstration (sic).
"We saw some demonstrations today frankly that were incredible.
"The talent of these young, brave, strong people.
"Seamless cooperation between our militaries is really just vital to addressing the many shared security threats we have."
The US President watched the Special Forces exercise while the First Lady met Chelsea pensioners in London.
Asked about the benefit of keeping US troops in Europe, Mr Trump said: "There is a benefit. There's a psychological benefit and there's a military benefit. There's also a benefit not to do it."
Referring to the NATO summit, he said: "I was prepared to do things that would have been somewhat harsh yesterday. A lot of people were surprised that NATO all came together at the end.
"And it wasn't a threat, I mean, it was just an unfair situation. We were paying 90% of the cost of NATO, and NATO is really there for Europe much more so than us."
After talks with Theresa May at Chequers, the US President and First Lady Melania Trump headed to Windsor Castle to meet the Queen.
The guests were treated to a Guard of Honour when they arrived at the royal residence in Berkshire on Friday afternoon.
Formed of the Coldstream Guards, the Guard of Honour gave a Royal Salute and played 'The Star-Spangled Banner', the national anthem of the United States.
The 1st Battalion Coldstream Guards is one of the British Army's longest serving units, and its musicians are among the oldest and best-known military marching bands in the world.
The Queen and President Trump inspected the Guard of Honour before watching a military march past.
The US President and First Lady also took tea with the Queen.
On Friday morning, Trump spoke of his admiration for the Queen in a newspaper interview, in which he called her a "tremendous woman".
He told The Sun: "If you think of it, for so many years she has represented her country, she has really never made a mistake. You don't see, like, anything embarrassing. She is just an incredible woman.
"My wife is a tremendous fan of hers. She has got a great and beautiful grace about her."
The Queen has played host to three other US Presidents at Windsor Castle since the 1980s - Barack Obama in 2016, George W. Bush in 2008 and Ronald Reagan in 1982.
Meanwhile, one of the largest Police operations has been underway to cover President Trump's brief visit amid protests across the UK.
Nearly every force in England and Wales has contributed officers to help with the security effort, the biggest since the 2011 riots.
Mr Trump's audience with the Queen is not part of a state visit - an offer that was extended to him by Prime Minister Theresa May in the early days of his presidency.