I have heard that it is allowed in Iran.
Gender transition is not allowed when it means a male trying to become a female or a female trying to become a male just for desire.
If a person is really female in her chromosomes and body but has some abnormal male signs in her body , she can then remove the abnormalities and become full female. Same with a male who is male in his chromosomes and body but has abnormal female signs, he can remove that abnormalities and become perfect male.
Rectification which makes the person remove any abnormality is allowed but changing the gender is not allowed.
It must be mentioned that such operations must not allow unlawful looking or touching.