The ruling marks the first time since 1965 that a president has seized command of a state’s National Guard without the governor’s consent.