I guess, if they are going to pay for their hormone treatments and doctors assess they have the ability to serve without endangering themselves or those around them, yes.
There is the recruitment angle. I have posted this before, but generally, the all-volunteer military comes disproportionately from the states from Virginia, down through the former Confederacy to Texas and then up the Great Plains to the Canadian border. Those are the states on which the services lean disproportionately for recruits. These states tend to be more socially conservative than, say, Massachusetts and the West Coast.
The number of men calling themselves women and women calling themselves men is very small, but if having them in the ranks costs the services recruits from that crescent, then it could be a net loss in recruiting. Retaining such people in the military might mean the retention of 500 soldiers. If that causes 10,000 potential recruits to seek other opportunities, then you are still down 9,500 recruits. I do not know what the numbers are and I am an old guy, so I may be out of touch with the values of young men (and women) today. I do know from personal experience. One of the female soldiers I trained and put into the army resigned when forced to tell female soldiers that, "if you see a soldier with a penis in the female communal shower, this is normal." As soon as she could, my former student resigned. She was a good kid, but was unwilling to compromise on this.