According to the Jewish scriptures God revealed to prophet Isaiah (peace be upon him) (56: 4-5): "For thus says the Lord: to the eunuchs who keep my Sabbaths, who choose the things that please me and hold fast to my covenant, I will give, in my house and within my walls, a monument better than sons and daughters, I will give them an everlasting name that shall not be cut off."
The terms that our Prophet Muhammad (s.a.s.) used for male or female transgenders and intersexuals, was derived from one grammatical root and hint to a close relation between both groups. Both terms are derived from the word "khanath" (roughly "hermaphroditism"); "khuntha" describes the intersexual and "mukhannath" the male to female transgender. In general speech both terms were sometimes used interchangeably and popular culture did not seem to discriminate a lot between a khuntha and a mukhannath.
Although the Holy Quran already mentions the fact that it is the entering of the male sperm into the female ovum that defines the chromosomal sex of the embryo and although early Muslims were aware of this, the Ahadith of noble Prophet Muhammad (s.a.s.) also hint to the idea that the causes for one’s gender identity are established by God later during early pregnancy together with the fate of the person: e.g. Sahih Bukhari, Volume 1, Book 6, Number 315: Narrated Anas Ibn Malik:
The Prophet said, “At every womb Allah appoints an angel who says, `O Lord! A drop of semen, O Lord! A clot. O Lord! A little lump of flesh.´ Then if Allah wishes (to complete) its creation, the angel asks, `Will he be male or female, a wretched or a blessed, and how much will his provision be? And what will his age be? ´ So, all that is written while the child is still in the mother` s womb."
The hijras claim that "their society was once known from India to Spain", which was the expansion of the medieval Muslim empire, and older hijras who did the Hajj (pilgrimage to Makkah) sometimes hint to a close connection between their society and the ancient society of "eunuchs" that guarded the grave of noble Prophet Muhammad (PBUH) and the sacred mosque in Makkah. In that way one might assume that today’s Muslim hijra communities are the only intact survivors of medieval Muslim "mukhannath" society, while at the same time having local connections to ancient Hindu traditions.