"We think it's very susceptible to legal challenge," he told CNN's Alisyn Camerota Thursday on "New Day." "If they make an attempt to pull that money, it will be from NYPD, from security funding to fight terrorism."
"If an attempt is made to do that, we will go to court immediately for an injunction to stop it," de Blasio added. "We believe the executive order is vague and in some ways contradictory."
What are sanctuary cities, and can they be defunded?
Trump signed Wednesday an executive order that he hopes will crack down and strip funding from "sanctuary cities," a term used for jurisdictions with policies that limit cooperation between or involvement with federal immigration enforcement actions.
The concept of sanctuary cities apparently originated in churches in the 1980s that were providing sanctuary to Central Americans fleeing violence in their home countries despite the federal government being reluctant to grant them refugee status.
Sanctuary cities became more popular in cities with more diverse communities to counter what leaders considered extreme federal immigration policies, especially against those who were arrested for minor, non-violent crimes.
If enforced, the order will "strip federal grant money from the sanctuary states and cities that harbor illegal immigrants," said White House Press Secretary Sean Spicer.
The order states that these cities will be "not eligible" for federal grants and orders the Office of Management and Budget to compile federal grant money presently going to those jurisdictions.
De Blasio is among several high-profile mayors protesting the move, calling it a national security disaster.
"It's going to make cities less safe. That is the bottom line," he said.
The NYPD has spent decades building relationships with immigrant communities, de Blasio said, and if undocumented people fear deportation they will not come forward to report suspected criminal activity, including terrorism.
"This is the kind of thing that will destroy that progress and make it impossible for the police to keep cities safe," he said.
The mayor also spoke of the need for Congress to provide New York City federal funds for securing the first family.
"It's put a huge strain on the NYPD to protect not only the First Family and the staff that's been working at Trump Tower but Trump Tower itself, which is a very centrally located and very vulnerable building," De Blasio said. "It's costing us about half a million dollars a day to secure a building that is exposed on."
"We're going to keep doing that, it's the right thing to do. But we do expect the Congress to reimburse the people of New York City and the NYPD so we can continue to do the work of safety all over this city," he said.
Los Angeles Mayor Eric Garcetti said Thursday that keeping funding from sanctuary cities is not "the right approach" to deal with national security.
"I don't think that taking away city funding - our tax dollars that we should be able to determine how we spend locally - is the right approach any more than I think as a father that dividing families is the right approach," he said on CNN's "At this Hour."
The Democrat acknowledged that the immigration system was broken but expressed concern about straining the relationship between law enforcement and immigrants.
"We want federal law enforcement officials to do their job with federal laws, but we don't enforce tax laws. We don't enforce mail fraud. And I don't want to take my cops off of that important work because of an ideological wish of anybody in the White House," he said.