He visited troops at Bagram Air Field to thank the men and women for their service, calling them "courageous American warriors."
"I just want to say that we thank god for your help and all of the things that you've done. You're very special people and you don't even know how much the people of our country love and respect you," Trump said to a few hundred troops.
His remarks shifted to a deal with the Taliban, as Trump said peace talks had been re-ignited.
"We will see if the Taliban wants to make a deal. … If they do, they do," Trump said during his visit. "If they don’t, they don’t."
The terms of the deal would have to include a Taliban ceasefire, Trump said, adding that he thinks the Taliban will agree to that.
When asked if the U.S. had restarted peace talks with the Taliban, he replied with "yes," but did not offer more details. Back in September, he declared peace talks with the Taliban "dead."
Chairman of the Joint Chiefs of Staff Gen. Mark Milley said "hopefully they will be successful and lead to Afghan-to-Afghan dialogue in the near future."
President of Afghanistan Ashraf Ghani, who Trump met with during the visit, did not publicly address such talks.
Trump also boasted about the recent death of ISIS leader Abu Bakr al-Baghdadi -- saying, "We took him out" -- and said that now ISIS is down to "a very small number."
Trump landed in Afghanistan at 11:03 a.m. EST on Air Force One after a 13-hour secret overnight flight out of an undisclosed airport in Florida.
It was his second trip to a combat zone. He visited troops in Iraq in 2018 after Christmas.
He was travelling alongside acting White House Chief of Staff Mick Mulvaney, White House Press Secretary Stephanie Grisham, National Security Advisor Robert O’Brien, and Sen. John Barrasso, R-Wyo.
First Lady Melania Trump stayed behind in Florida, officials said.
Upon touching down in Afghanistan, President Trump helped serve Thanksgiving dinner to roughly two dozen troops at Bagram Air Field’s dining facility.
Before speaking to the troops, President Trump told some in the dining hall that he would be talking to them later, "but right now I want to have some turkey."
Last year, the president stayed in the U.S. for Thanksgiving and spoke with troops in Afghanistan on the phone while at his Mar-a-Lago resort in Florida.
After expressing gratitude for their service, he took time to criticize the appeals court that blocked his administration's efforts to deny migrants if they seek asylum after entering from outside formal points of entry.
In 2017, the president also stayed in Florida and spoke with troops in Afghanistan, Iraq, Turkey and Bahrain and aboard the USS Monterey on a video call.
ABC News' Shannon Crawford, Meredith McGraw and Conor Finnegan contributed to this report.