"We join all Americans in welcoming their newly regained freedom," he tweeted.
The two Americans, Sandra Loli and Mikael Gidada, and the remains of a third, Bilal Fateen, were released in exchange for the return of about 250 of the Iranian-backed Houthi rebels from Oman, according to the White House.
Oman's state news said the American captives were flown out of Yemen on an Omani plane. It said 250 "Yemeni brothers" who received treatment in Oman have been returned to Yemen's capital, Sanaa, on two flights as part of the exchange.
Kieran Ramsey, director of the administration's hostage recovery cell, said Loli and Gidada would soon be on their way back to the United States.
"Tragically, one of these Americans died during his unlawful captivity," Ramsey said.
Kash Patel, a deputy assistant to Trump who worked on the deal, told The Wall Street Journal that Loli had been held by the Houthis for about three years and Gidada was held captive for about a year.
Yemen plunged into chaos and civil war when the Houthi rebels took over Sanaa in 2014 from the internationally recognized government. A Saudi-led coalition allied with the government has been fighting the Houthis since March 2015. The war has left millions without food and proper medical care and has killed more than 112,000 people.
The release of the Americans came a day before a planned U.N.-brokered exchange of more than 1,000 prisoners between the Houthis and the internationally recognized government. The U.N. had said in September that the two warring sides agreed to exchange 1,081 conflict-related prisoners, including Saudi and Sudanese troops fighting on the side of the Saudi-led coalition.
The Associated Press contributed to this report.