Contrary to what some people think, this is a medical issue, NOT a moral issue. Sadly, some try to oversimplify things with statements like "God makes everyone male or female," or "If the chromosomes are XY, it's a male, if they are XX, it's a female."
These statements overlook the plain fact that children are frequently born with no clear physical sex, either having the organs of both, or organs that don't clearly indicate either sex. They also ignore the fact that the human race is not neatly divided into two groups, one with XY chromosomes, and one with XX. There are a number of sex chromosome disorders:
So clearly, the human race is not neatly divided into two groups as some believe. Sex differentiation begins in the first trimester of pregnancy. Besides disorders of chromosomes, other things can influence this negatively. For example, if the pregnant woman is exposed to extraneous hormones, this can negatively affect the developing embryo, whether the source of the hormones is external, or something created by her own body.
Another unusual event that could occur early in pregnancy, probably before implantation of the blastocyst that will become the embryo, is the joining of two blastocysts into one. If there are two fertilized ova, one genetically male, the other female, and they attach to each other, they can merge to the point of becoming one embryo... but that embryo may have the chromosomes of both sexes, and even the organs of both sexes.
Gender identity is separate from physical sex, although probably develops at the same time, and is undoubtedly initiated by the same sequence of events. But just as things can go wrong with the development of physical sex, so too things can go wrong with the development of gender identity, and it is possible for an individual to be born with a gender identity that does not match the physical sex, even if there is no detectable underlying chromosomal abnormality.
A couple of points before going on: Gender identity and sexual orientation are entirely unrelated things. When determined from gender identity, the great majority of transgender individuals are heterosexual. Second, despite the misconceptions of some, gender identity is not the product of environment. If it were, we would be unlikely to see any transgender people at all. But when one is confronted with a child of four, who has been raised according to physical sex, who insists, despite all evidence to the contrary, that he or she is the other, it becomes apparent that there is more to it than upbringing. Now, this is not the same as, for example, a stage some girls may go through where they wish they were boys. Wishing to be the opposite sex, for whatever reason or for however long, is a far cry from believing that one actually is the opposite sex.
A person who is transgender has that sense of "wrongness," usually from earliest memories, and will have a firm, unshakeable knowledge of being the gender opposite that suggested by physical organs. Such a person cannot be "talked out" of the conviction, nor is it something to be masked with psychotropic medication. Medical science has no means at present to alter a person's gender identity. It appears to be fixed prior to birth and immutable. So the only solution it can offer is SRS - Sex Reassignment Surgery, although not all transgender persons opt for it. (For many, the cost is prohibitive, and it's rarely covered by insurance.)
It bears mentioning, since there are unlearned people who claim otherwise, that people who have undergone SRS are generally quite happy with their decision, and are much less likely to be depressed than those who have not. It also bears mentioning that transitioning while young has significant advantages, particularly for those transitioning from male to female. During puberty, male hormones are responsible for the growth of facial hair, broad shoulders, voice change, subtle developments of the brow and perhaps jawline, size of hands, and even height. And these changes are not desirable for a person who identifies as female! So parents of a transgender child who allow their child to dress according to gender identity,and to take a puberty-blocking medication, are not negligent or abusive, but doing their child a tremendous favor. It's also important to understand that a person cannot self-diagnose as transgender and walk into a doctor's office and get hormones and arrange for SRS. A professional diagnosis is required.
From time to time, a child is born with a cleft palate or club foot, or even a serious heart defect. With very few exceptions, nobody would object to surgery to correct such things. (There are some whose religious beliefs would insist that parents rely solely on faith in such cases.) But the majority of people would never suggest that such surgeries, whether to save a life or to correct a deformity, were sin. So why is it that when the surgery involves genitalia some immediately assume there is sin involved? (There is actually one case known to us where a child was born with ambiguous genitalia, and the parents' church said any intervention would be sin. This child grew up with no clear gender, and severe psychological problems.)
Once it has been medically established that a person has a mismatch between physical sex and gender identity, transitioning (hormones, living as the target sex, and surgery) is no more sinful than surgery to correct a cleft palate. It vastly improves the quality of life and hurts no one.
Scripture does not address this issue... just as it doesn't address many issues the writers didn't know about. But that doesn't mean it is wrong for us to address them, and deal with them according to the best medical knowledge available.