Trump is Commander in Chief. The Judge is not in that chain of command. Our military isn't a social club, and even operates under a separate judicial system under the UNMJ, not the same laws the rest of us live under.
What military rules have these folks broken? They volunteered to serve, and as far as I know are serving honorably. The military itself - under direction, I assume, from its then-Commander in Chief - permitted transgenders to come forward and serve as such openly. Now the rule is proposed to be changed, in a way that would destroy the careers of those who followed the prior rule. And a court now has stayed the new rule pending adjudication on the merits, in order to preserve, at least for the time being, those careers.
But you still insist on persecuting these folks when they've done absolutely nothing dishonorable or inconsistent with the rules under which they have served? This purging of transgenders wasn't recommended by military leaders, it has been ordered by a civilian President - a chickenhawk, no less (since you raise the issue of my own military service) - kowtowing to a political base of intolerant social conservatives.
I profess no opinion on the merits of the rule change. Perhaps there are sound military reasons for banning transgenders as a class from service, and perhaps the rule should be that civilian courts should generally defer to the considered judgments of military commanders. But military commanders didn't order or recommend this change - and it is well within the authority of this court to stay the order pending a final decision whether the rule represents military necessity or pandering to a bigoted political base.