1. Federal employees could refuse, even at the price of being fired, in enough numbers that there isn't a functioning government if he fires them all.
2. Congress could impeach for ignoring the court ruling.
3. The people could decide that, if he is going to ignore the constitution, then they're going to ignore him (and the whole federal government), since it's only the constitution that says that they need to listen to the president. If the president tries to enforce it by force, then it becomes a civil war; if not, then the country just collapses into the states.
(Keep in mind that the military's oath is to the constitution, not to the president. If the president is giving them orders contrary to the constitution - and contrary to a court order stating that the orders are against the constitution - it is far from clear that the military will obey them.)
But if none of those happens, then sure, the president can order whatever he wants.