Because the President can take over the state guard "to execute the Laws of the Union." (U.S. Const., Art. I, sec. 8, cl. 15). The last time I can remember where a state refused to enforce a federal court order was when the federal courts ordered the desegregation of Central High School in Little Rock, Arkansas. The federal judge sent U.S. Marshals to enforce the order; the Governor called out the National Guard to block them; so President Eisenhower federalized the National Guard and the school was desegregated.
Then we need to un-federalize the guard.