The Republican president tweeted that his antagonists should be “very happy” about the idea given their “open borders, open arms policy”.
He said he was targeting so-called sanctuary cities, which have policies to aid undocumented immigrants.
But there was scepticism on the left and right about Mr Trump’s idea.
Mr Trump tweeted on Friday: “Due to the fact that Democrats are unwilling to change our very dangerous immigration laws, we are indeed, as reported, giving strong considerations to placing Illegal Immigrants in Sanctuary Cities only.”
The president’s declaration undercut his own White House, which had denied in a statement that the plan was still being considered.
Mr Trump’s comments followed reports in US media that he had wanted the Department of Homeland Security to release detained migrants in sanctuary cities.
The White House had asked agencies last November and again in February this year whether Central American immigrants detained in the US could be sent to “small- and mid-sized sanctuary cities”, the Washington Post first reported.
Immigration and Customs Enforcement (ICE) had reportedly rebuffed the idea, citing budget and liability issues.
The agency also expressed concern over how the public might view the move, according to emails viewed by the Post.
On Thursday, the White House said in a statement to the Post that the idea was “just a suggestion that was floated and rejected”.
The most powerful elected Democrat, House of Representatives Speaker Nancy Pelosi, railed against the plan as un-presidential.
She told reporters on Friday: “It’s just another notion that is unworthy of the presidency of the United States and disrespectful of the challenges that we face as a country, as a people, to address who we are: a nation of immigrants.”
Sanctuary cities are jurisdictions – such as New York, Los Angeles, San Francisco and Chicago – that have municipal policies to limit their co-operation with federal immigration enforcement.
Chicago’s outgoing Democratic Mayor Rahm Emanuel said in a statement: “What President Trump fails to understand is that America is a sanctuary country.”
San Francisco Mayor London Breed poured scorn on the idea.
“Like so many issues we are forced to talk about during this presidency,” she said, “this isn’t a real idea or a real proposal, it’s just another scare tactic.”
A vocal hardline conservative on immigration was also doubtful the plan would ever become a reality.
Ann Coulter tweeted: “What is the one thing we know will NOT happen at any time in the future?
“Answer: The Trump administration will place Illegal Immigrants in Sanctuary Cities Only.”
Mr Trump has previously ordered federal funding to be withheld from sanctuary cities, but that plan was torpedoed by a federal judge in California in August last year.
He has amplified his criticism of illegal immigration since Congress denied funding for his long-promised border wall earlier this year.
The president – who often depicts those crossing the US-Mexico border without papers as criminals – recently retreated from a threat to close the international boundary.
Meanwhile, his plan to make asylum applications more difficult was thwarted by a federal judge only this week.