Mr Trump said the court system was “broken and unfair”.
In September, he rescinded Deferred Action for Childhood Arrivals (Daca), but San Francisco Judge William Alsup said it had to stay while litigation against Mr Trump’s move continued.
The Obama-era scheme protects some 800,000 people.
It also provides temporary permits for work and study.
Mr Trump attacked the ruling on Twitter: “The opposing side in a case (such as Daca) always runs to the 9th Circuit and almost always wins before being reversed by higher courts.”
Judge Alsup’s court is the District Court for the Northern District of California. The Ninth US Circuit Court of Appeals commonly examines appeals of rulings made in Judge Alsup’s court and others.
Earlier, White House press spokeswoman Sarah Sanders described the ruling as “outrageous”.