It wasn't immediately clear what happens next for people who had waited years to receive visas to come to America, however an internal email circulated among Homeland Security officials told employees to comply with the ruling immediately. About 60,000 people from the affected countries had their visas cancelled by the State Department.
The judge's order was a victory for Washington and Minnesota, which had challenged Trump's directive. U.S. District Judge James Robart in Seattle issued a temporary restraining order, ruling the states had standing and said they showed their case was likely to succeed.
"The state has met its burden in demonstrating immediate and irreparable injury," Robart said.
Trump's order had caused widespread confusion at airports as some travelers were detained. The White House has argued that it will make the country safer.
White House spokesman Sean Spicer released a statement late Friday saying the government "will file an emergency stay of this outrageous order and defend the executive order of the President, which we believe is lawful and appropriate." Soon after, a revised statement was sent out that removed the word "outrageous."
"The president's order is intended to protect the homeland and he has the constitutional authority and responsibility to protect the American people," the statement said.
Washington became the first state to sue over the order that temporarily bans travel for people from Iran, Iraq, Syria, Sudan, Somalia, Libya and Yemen and suspends the U.S. refugee program globally.
State Attorney General Bob Ferguson said the travel ban significantly harms residents and effectively mandates discrimination. Minnesota joined the lawsuit two days later.
After the ruling, Ferguson said people from the affected countries can now apply for entry to the U.S.
"Judge Robart's decision, effective immediately ... puts a halt to President Trump's unconstitutional and unlawful executive order," Ferguson said. "The law is a powerful thing - it has the ability to hold everybody accountable to it, and that includes the president of the United States."
The judge's ruling could be appealed the 9th U.S. Circuit Court of Appeals.
The judge's written order, released late Friday, said it's not the court's job to "create policy or judge the wisdom of any particular policy promoted by the other two branches" of government.
The court's role "is limited to ensuring that the actions taken by the other two branches comport with our country's laws."
Robart said federal defendants "and their respective officers, agents, servants, employees, attorneys and persons acting in concert or participation with them are hereby enjoined and restrained from" enforcing the executive order.
A State Department official, speaking on condition of anonymity because the matter is under litigation, said Friday: "We are working closely with the Department of Homeland Security and our legal teams to determine how this affects our operations. We will announce any changes affecting travelers to the United States as soon as that information is available."
Federal attorneys had argued that Congress gave the president authority to make decisions on national security and immigrant entry.
The two states won a temporary restraining order while the court considers the lawsuit, which aims to permanently block Trump's order. Court challenges have been filed nationwide from states and advocacy groups.
In court, Washington Solicitor General Noah Purcell said the focus of the state's legal challenge was the way the president's order targeted Islam.
Trump has called for a ban on Muslims entering the country, and the travel ban was an effort to make good on that campaign promise, Purcell told the judge.
"Do you see a distinction between campaign statements and the executive order," Robart asked. "I think it's a bit of a reach to say the president is anti-Muslim based on what he said in New Hampshire in June."
Purcell said there was an "overwhelming amount of evidence" to show that the order was directed at the Muslim religion, which is unconstitutional.
When the judge questioned the federal government's lawyer, Michelle Bennett, he repeatedly questioned the rationale behind the order.
Robart, who was appointed to the federal bench by President George W. Bush, asked if there had been any terrorist attacks by people from the seven counties listed in Trump's order since 9/11. Bennett said she didn't know.
"The answer is none," Robart said. "You're here arguing we have to protect from these individuals from these countries, and there's no support for that."
Bennett argued that the states can't sue on behalf of citizens and the states have failed to show the order is causing irreparable harm.
Robart disagreed, and rejected a request from Bennett for an immediate stay of his order.
The State Department said Friday that Trump's order cancelled visas for up to 60,000 foreigners from the seven majority-Muslim countries. That figure contradicts a statement from a Justice Department lawyer on the same day during a court hearing in Virginia about the ban. The lawyer in that case said about 100,000 visas had been revoked.
The State Department clarified that the higher figure includes diplomatic and other visas that were actually exempted from the travel ban, as well as expired visas.
Ferguson, a Democrat, said the order is harming residents, businesses and the state's education system.
Washington-based businesses Amazon, Expedia and Microsoft support the state's efforts. They say it's hurting their operations, too.