Trump made the remarks during his meeting with visiting NATO Secretary General Jens Stoltenberg at the White House.
Trump again singled out Germany on Thursday, calling it "a very big beneficiary" that "must demonstrate leadership".
Trump also grumbled about Germany "buying massive amounts of gas from Russian Federation and paying billions and billions of dollars".
In July, Trump is expected to attend NATO's major annual summit in Brussels, where once again the US will press members to ramp up spending. Three European signatories to the pact - Britain, France and Germany - are continuing their support for the restraints on Tehran, even as Trump has contended the agreement does nothing to thwart Iran's ballistic missile tests or its military advances in the Middle East.
Stoltenberg praised Trump's work on shoring up North Atlantic Treaty Organisation, whose continued objective Trump questioned while campaigning in the 2016 election. The countries are Poland, Romania, Estonia, Latvia, Lithuania, Greece, and the United Kingdom.
Trump last week rebuffed opposition from European leaders and withdrew the US from the 2015 worldwide accord curbing Iran's nuclear weapons program.
He did not elaborate what measures would be taken to ensure compliance.
Eight NATO allies will reach the 2 percent benchmark by the end of this year, and 15 are on track to spend 2 percent by 2024, according to a statement released by the White House on Thursday.
Germany, however, has indicated it will renege on that pledge, which is likely to emerge as a flashpoint when alliance leaders meet in July.
"It is impacting allies because now all allies are increasing defense spending", he said. Stoltenberg stopped short of giving Trump all of the credit. NATO's top official also credited Trump with bringing a sense of heightened urgency to the issue. "We have a little ways to go, but many billions of dollars of additional money has been raised". "We have to do more", Stoltenberg said.