The US President landed early Thursday morning at the base in Rhineland-Palatinate, where his plane refuelled before continuing on to the States.
Trump, 72, and his wife Melania, 48, shook hands and posed for selfies with US soldiers based in Ramstein, who had gathered in a hangar for the visit.
“Hello, folks,” the president said as he greeted numerous people, the White House said.
The president and his entourage then headed back to the United States.
But he could return for another trip soon. German daily Bild reported Thursday that the US ambassador to Germany, Richard Grenell, 52, said recently that Trump wanted to come back to the country where his grandparents were born.
Troops welcome Trump in Ramstein. Photo: DPA
“I don't know when, but he told me that he wanted to come and see his family's hometown,” he said, according to Bild. Grenell is Trump's confidant and the president's most important ambassador in Europe.
Trump's paternal grandparents, Friedrich and Elisabeth Trump, came from Kallstadt in the Rhineland-Palatinate state. The village, which has 1,200 inhabitants, is famous for its wine – and is only about 60 kilometres from Ramstein. If he chose to, Trump would only need a few minutes to fly from the air force base to his ancestral homeland by helicopter.
The US President first visited Germany during his two-year term in office in July 2017 when he took part in the G20 summit in Hamburg. He has never been to Germany for a purely bilateral visit, nor has he ever been to the birthplace of his grandparents.
Trump's spokeswoman Sarah Sanders said that the President and the First Lady had flown to Iraq to “thank the US soldiers on the ground for their commitment, success and sacrifice and to wish them a Merry Christmas”.
Shortly before Christmas, US President Donald Trump had surprisingly announced that he would withdraw all American troops from neighbouring Syria because the ISIS militia had been defeated there and the mission had been achieved
Trump used his lightning visit to Iraq — his first with US troops in a conflict zone since being elected – to defend the withdrawal from Syria and to declare an end to America's role as the global “policeman.”
Trump landed at 7:16 pm local time at Al-Asad Air Base in western Iraq, accompanied by his wife Melania, following what he described as a stressful, secrecy shrouded flight on a “pitch black” Air Force One.
The president spoke to a group of about 100 mostly special forces personnel and separately with military leaders before leaving a few hours later. A planned meeting with Iraqi Prime Minister Adel Abdel Mahdi was scrapped and replaced by a phone call, the premier's office said.
During the call, Trump invited Abdel Mahdi to visit Washington and he accepted, White House spokeswoman Sanders said.
White House video showed a smiling Trump shaking hands with camouflage-clad personnel, signing autographs and posing for photos at the base in Iraq.
Morale-boosting presidential visits to US troops in war zones have been a longstanding tradition in the years following the September 11, 2001 terrorist attacks.
Trump has taken considerable criticism for declining to visit in the first two years of his presidency. But speculation had been mounting that he would finally make the gesture following his controversial plan to slash troop
levels in Afghanistan and his order to withdraw entirely from Syria.
At the Iraqi military base, Trump sought to defend his “America First” policy of pulling back from multinational alliances, including what to many Americans seem like the endless wars of the Middle East.
“It's not fair when the burden is all on us,” he said. “We don't want to be taken advantage of any more by countries that use us and use our incredible military to protect them. They don't pay for it and they're going to have to.”
“We are spread out all over the world. We are in countries most people haven't even heard about. Frankly, it's ridiculous,” he added.
Trump told reporters he had overruled generals asking to extend the Syria deployment, where about 2,000 US forces, joined by other foreign troops, assist local fighters battling the Islamic State jihadist group.
“You can't have any more time. You've had enough time,” he said he told the top brass.
Trump and Melania meet soldiers in Ramstein. Photo: DPA
The drawdowns — and the abrupt way that they were announced — helped lead to the resignation of Trump's defense secretary, Jim Mattis, who has been one of the administration's heavyweights.
In his typically forcefully-worded resignation letter, Mattis appeared to chide Trump when he stressed his own “strongly held” views on “treating allies with respect and also being clear-eyed about both malign actors and strategic competitors.”