Medical transition puts both males and females at risk of infertility.
A wide-ranging study  found that gender-related drug regimens place patients at risk of infertility:
Suppression of puberty with gonadotropin-releasing hormone agonist analogs (GnRHa) in the pediatric transgender patient can pause the maturation of germ cells, and thus, affect fertility potential. Testosterone therapy in transgender men can suppress ovulation and alter ovarian histology, while estrogen therapy in transgender women can lead to impaired spermatogenesis and testicular atrophy. The effect of hormone therapy on fertility is potentially reversible, but the extent is unclear.
On surgeries, the study noted that cross-sex surgery
that includes hysterectomy and oophorectomy in transmen or orchiectomy in transwomen results in permanent sterility.
 Cheng, P.J., Pastuszak, A.W., Myers, J.B., Goodwin, I.A. & Hotaling, J.M. (2019). Fertility concerns of the transgender patient. Transl Androl Urol. 8 (3): 209-218. [Link]