Iraq formally declared victory against the terror group a year ago, but U.S. troops have remained to help stabilize regions of the country and train Iraqi soldiers. "We've been doing it long enough".
But before Wednesday's trip to Iraq, Trump had taken some heat from critics for being the first president since 2002 not to make a Christmastime visit to troops in 2018. "Which is great, that means we don't have to pay", he said.
Trump has also wanted to end protracted USA involvement in overseas conflicts, and to force allies to pay more for the costs that he says fall disproportionately on American taxpayers.
While there has been no full-scale violence in Iraq since Islamic State suffered a series of defeats previous year, USA troops train and advise Iraqi forces still waging a campaign against the militant group.
"I made it clear from the beginning that our mission in Syria was to strip ISIS of its military strongholds", Trump told troop Al Asad Air Base. west of Baghdad.
Although Trump has previously addressed U.S. troops stationed overseas, including in Italy, Japan and South Korea, he has drawn criticism for not yet visiting those deployed to combat zones.
The American-led invasion in 2003 toppled Iraqi President Saddam Hussein, but for several years afterward USA troops engaged in extended fighting across the country, battling an insurgency and later sectarian violence. IS has lost a significant amount of territory in Iraq and Syria but is still seen as a threat.
The Latest: Trump defends withdrawal of troops from Syria
We now have video from President Donald Trump's speech to troops during his surprise trip to Iraq, and during his remarks he brought up the fight against ISIS.
The president has been criticized throughout his presidency for failing to travel to troops in the Middle East.
UPDATE [12/26/2018, 5:01 p.m. EST]: This afternoon, White House press secretary Sarah Huckabee Sanders announced that President Donald Trump and first lady Melania Trump had indeed visited military troops, arriving at Al Asad Air Base near Baghdad on Wednesday morning.
Trump had planned to spend Christmas at his private club in Florida, but stayed behind in Washington due to the shutdown.
Mr Trump's trip was shrouded in secrecy.
Trump has come under withering criticism from fellow Republicans, Democrats and worldwide allies over his decision to pull out of Syria because he believed Islamic State militants have been defeated.
There are dire implications in particular for neighboring Iraq. Many fear that the United States withdrawal could allow IS to regroup and strengthen, with Turkey more interested in fighting the Kurdish forces, which it sees as a danger to its own national interests.
US Gov't now in partial shutdown
Most of the Internal Revenue Service (IRS) will be sent on unpaid leave, including those who assist taxpayers with queries. The US Postal Service, which is busy in the holiday season, will not be affected because it is an independent agency.