Judge April M. Perry said the Trump administration had not established that sending in troops over the governor’s objection was legally justified. An appeal is likely.