If your question is:
Would the military be obliged to pay for the transition?
Then the answer is yes. Prior to Donald Trump's tweets, the US Military had promulgated guidance on how it would support members transitioning. Following a diagnosis of gender dysphoria, the Military member would be supported through medical treatments, to include hormones and the eventual surgeries, and be allowed to practice acting like their intended gender. Once further along in the process, their gender would be administratively changed in the Defense Enrollment Eligibility Reporting System, and then they'd be treated per their intended gender in all things, to include uniform requirements, berthing assignments, billeting, etc.
That being true, the question providing amplifying guidance,
If not, what medical costs is he on about?
Does not apply.
Now, if we look to Donald Trumps tweets, specifically the one referencing medical costs, it doesn't stop there:
"....victory and cannot be burdened with the tremendous medical costs and disruption that transgender in the military would entail. Thank you"
The medical costs, while concerning, aren't the strongest issue with members of our all volunteer uniformed service. The other disruptions aren't accounted for, such as: work-hours lost due to disability, additional demands placed those around the billet impacted, and administrative burden. Finally, there is the impact to military readiness.
Additionally, it must be noted that military doctrine isn't written to cover every corner case, and certainly not .1 to .5 percent of the serving population.
Work hours lost
For the duration of the transitioning period, the member is waived from a majority of physical qualification requirements (table 6.1), and also placed on limited duty. If the service member is in a physically demanding job, they can't do their job. If the side effects of the drugs impact the mental readiness of the service member and they carry special certifications or clearance, they may be dis-certified from continuing in that billet.
Is every service member a grunt on the front lines? Obviously not. However; every Marine, by the nature of doctrine, is a rifleman; every underway sailor, is a fireman; I can't tell you what every member of the Air Force/Army is. That is why the services have physical fitness standards. For male-to-female, with the expected loss in muscle mass, there remains a concern that they'll be able to meet the new standards. For female-to-male transitions, while there is a gain muscle mass, will it be enough to meet the new standards? Even further, there is the differences in blood-oxygen absorption rates, bone density and skeletal structure, and other gains influenced by developing as a genetic male. Are there women that can meet and exceed the physical fitness standards? Certainly, but policy isn't written for the outliers, and must not be. Statistical averages, and overall efficiency, are the norm.
However, it isn't like being transgender is the only discovered medical condition that will get people excused from their current billet or the service overall. For comparison, here is a quotation from the MANMED manual on the general items that could disqualify an individual from service in the nuclear field. Taking medication for migraines is enough to lose the ability to serve in a plant.
"Any condition, combination of conditions, or treatment which may impair judgment or alertness, adversely affect reliability, or foster a
perception of impairment is disqualifying. Nuclear field personnel returning to duty following an absence of greater than 7 days due to illness or injury,
hospitalization for any reason, or after being reported on by a medical board must have a properly documented UMO or RAM evaluation to determine fitness for continued nuclear field duty."
If unable to execute the demands of their job, that work must be taken up by others. This increases the strain placed upon the affected unit, beyond which is already being experienced by other stressers.
There is an extensive administrative burden placed upon the command in supporting a transitioning service member, to include berthing arrangement, paperwork processing, convening medical boards, mitigating the negative impact to the command. There is the other resultant trouble of possible idiots in the command, but that sis an ever present issue anyway.
While being provided hormonal treatment, if male to female, they are losing muscle mass and becoming less effective soldiers. This is detrimental to the intended design of the United States Military, delivering a powerfully lethal fighting force as the ultimate projection of US diplomatic power.
For clarity, it is not the intention of this answer to defend or advance banning transgender persons from serving in armed services of these United States. If an individual so inclined can meet the requirements for their current gender and the desired billet, they are welcome to risk life and limb for country. With an all volunteer force that averages 1% of the population, more people joining increases the flexibility of the forces. Individuals should be allowed to join prior to, or after, transitioning to their preferred gender; however, the diversion of limited military funding, man hours, and attention while they are in the military is deleterious to the design intention of the force. As negligible as the RAND study claims those impacts to be, they still make the armed forces less efficient overall.
To be heartless, why should the military fund an elective/corrective procedure for military personnel that doesn't directly benefit the military? There is not a valid comparison between transitioning active duty members and the medical care provided to veterans. The military does not fund every medical procedure for every veteran, but to properly evaluate the groups separately: those who left the military prior to retirement, and those who retired from the military or were medically retired from the military due to being found physically unfit for continued service. In the former, the Department of Veterans Affairs (VA) intentions are to cover service related injuries. Mess up your joints/back in the service, to X percentage of disability, and the VA covers you. In the later, it is seen as an incentive to make a career in the military, to maintain vital human capital, or to directly treat those grievously injured while in service. This is the return on the check you signed upon joining, payable with your body and life.
In truth, the majority of the military doesn't care about race, gender, orientation, etc. Can you do the job? Do you keep me from dying? Then carry on.