"I defeated the Caliphate," Trump told reporters in the Oval Office during a meeting with Australian Prime Minister Scott Morrison.
"And now we have thousands of prisoners of war, ISIS fighters," Trump said using one of the acronyms for the Islamic extremist group.
"We're asking the countries from which they came, from Europe, we're asking them to take back these prisoners of war," Trump said. "And they can try them, do what they want.
"So far, they've refused," Trump said, singling out Germany and France.
"And at some point, I'm going to have to say, 'I'm sorry, but you either take them back or we're going to let them go at your border,'" he said.
"Because the United States is not going to have thousands and thousands of people that we've captured stationed at Guantanamo Bay, held captive at Guantanamo Bay, for the next 50 years and us spending billions and billions of dollars," Trump said.
"We've done Europe a tremendous favor," Trump continued. "If they don't take them back, we're going to probably put them at the border and then they'll have to capture them again."
Trump made a similar threat about a month ago when he complained about the reluctance of European countries to take back their captured nationals.
Thousands of captured IS fighters, including many Europeans, are being held in camps in Syria.