A lot of history is speculative, but....
"The Middle East
In the Middle East (Cradle of Civilization), MTF (male-to-female) priestesses were known to have served Astarte, Dea Syria, Atargatis and Ashtoreth / Ishtar. Additional MTF "gallae" served Cybele, the Phrygians' embodiment of The Great Mother. Trans expression was also present in the early genesis of the Kumbh Mela festival in Allahbad (India).
For centuries, Muslim tradition differentiated between MTF transsexuals who live as prostitutes or criminals, and those in whom femininity was innate and who lived blamelessly. The latter were called "mukhannathun," and accepted within the boundaries of Islam. Mukhannathun could have relationships with either men or women, but only those who had been castrated or were exclusively attracted to men were allowed into womens' spaces. Later, it was ordered that all mukhannathun undergo castration.
Africa
In Africa, intersexed deities and spritual beliefs in gender transformation are recorded in Akan, Ambo-Kwanyama, Bobo, Chokwe, Dahomean (Benin), Dogon, Bambara, Etik, Handa, Humbe, Hunde, Ibo, Jukun, Kimbundu, Konso, Kunama, Lamba, Lango, Luba, Lugbara (where MTFs are called okule and FTMs are called agule), Lulua, Musho, Nat, Nuba, Ovimbundu, Rundi, Sakpota, Shona-Karonga, Venda, Vili-Kongo, and Zulu tribes. Some of this tradition survives in West Africa, as well as Brazilian and Haitian ceremonies that derive from West African religions. In Abomey, the Heviosso maintain trans traditions, in an area renowned for Amazon-like warrior women.
In seventh Century BC, King Ashurbanipal (Sardanapalus) of Assyria spent a great deal of time in womens' clothing, something that was later used to justify overthrowing him. In Egypt, 1503 BC, Egyptian Queen Hatshepsut ascended to the throne, the second Egyptian queen to rule (the first was Queen Sobekneferu of the 12th Dynasty). Possibly learning from the disfavor shown to her predecessor, she donned male clothing and a false beard signifying kingship, and reigned until 1482 B.C. She had one daughter, Neferure, who she groomed as successor (male clothing, false beard and all), but Neferure did not live into adulthood. After her death, her second husband attempted to erase all record of her. And Nzinga ruled as King of Angola from 1624 - 1653, cross-dressed and led several successful military battles against the Portuguese.
Asia
In Asia, Hijras persist even today, although their reverence is often limited to the belief that their presence at weddings is a good portent for the couple. They do tend to suffer in the modern Indian caste system, something that "eunuchs" of all types are banding together to work to improve (i.e. only recently was a Hijra able to vote, and now there have been Hijran elected officials). Historically, they have often worshipped the mother-goddess Bahuchara Mata, although some also worshipped Shiva in his half-man, half-woman persona, Ardhanarisvara.
Many early Indonesian societies had transgender figures in religious functions, including the basaja, from the island of Sulawesi (The Celebes). In ancient China, the shih-niang wore mixed-gender ceremonial clothing. In Okinawa, some shamans underwent winagu nati, a process of "becoming female." In Korea, the mudang was a shaman or sorceress who was quite often MTF. In February 1995, archaeologist Timothy Taylor discovered evidence of transgender lives in the Iron Age graves found in southern Russia.
Fanchuan was a name given to stage crossdressing, such as male-to-female performances in Beijing opera, and female-to-male acting in Taiwanese Opera. Chui Chin, a cross-dressing Chinese revolutionary and feminist was beheaded in 1907 for organizing an uprising against the Manchu dynasty.
Europe
In Europe, MTF priestesses served Artemis, Hecate and Diana. Early traditions thrived longest in Greece, and the mythology of the day encorporated tales of cross-dressing by Achilles, Heracles, Athena and Dionysus, as well as literal and metaphorical gender changes. The blind prophet Tiresias is often mentioned as a figure who had lived many years of his life in each different gender, and was said to have possessed acute wisdom for it. The tale of an FTM character, Kaineus (Caeneus), who was viewed as a "scorner and rival of the gods" and was driven into the earth by the Centaurs, is an example of Greek mythology attempting to subvert earlier trans-oriented legends. And Cupid was a dual god/dess of love, originally portrayed as intersex. The child of Hermes and Aphrodite, one of Cupid's variant names provided the origin for the term, "hermaphrodite." Some time between 6th Century and 1st Century BC, in the Greek Hippocratic Corpus (collection of medical texts), physicians propose that both parents secrete male or female "bodies" and that if the father's secretion is female (rather than male) and the mother's is male, the result would either be a "man-woman" (effeminate male) or a "mannish" female.
In the later development of Europe, early alchemists borrowed from pre-Christian spirituality at times, and some of these mystics created the concept of the "chemical wedding," a merger of male and female spiritual attributes to achieve perfection. Some alchemists saw this as a chemical concept that would lead to the process of transmuting lead into gold, while others touted that this was more of a personal, spiritual transformation. While much of this was later absorbed into secret societies such as the Freemasons and Rosicrucians, the belief hints at transformative and bigender-conscious reverence. Even the Bible has such "gender-wedding" imagery at times, in allusions to the "Bride of Christ" found in the Book of Revelations and some comments by later epistle writers.
The Amazons, a group of warriors often in conflict with Greeks and later mythologized, seem to have been thought of as trans, and Pliny the Younger referred to them as the Androgynae "who combine the two sexes." They carried double-edged axes which may have been symbols of intersexuality, as were those carried by the South American tribe that inspired the naming of the Amazon River.
In the Klementi tribe of Albania, if a virgin swore before twelve witnesses that she would not marry, she was then recognized as male, carried weapons, and herded flocks.
Years later, Joan of Arc was said to have followed in the traditions of Gentiles and heathen. In France, "gens" referred to matrilineal farming communities, indicating some pre-Christian tradition that she evidently had stirred up, inspiring older values and explaining why she had become such a potent threat to the church while alive (more later).
North America
In North America, as late as 1930 (with the Klamath in the Pacific Northwest), Two-Spirit Natives are noted among tribal communities. Originally called "berdache," a name of largely insulting intent given by Europeans, Native culture adopted the term "Two-Spirit" as a blanket term -- though in reality, nearly every tribe had at least one (often several) unique name for Two-Spirit peoples, with the names sometimes addressing different aspects of those populations. Two-Spirit actually covers the full range of gay, lesbian, bisexual and transgender persons, as well as intersex and other gender-variant people. It was often thought that Two-Spirits had two spirits inhabiting the same body, and that Two-Spirit people deserved a special kind of reverence. Jesuit priest Jacques Marquette notes that in the Illinois and Nadouessi tribes, nothing is decided without their advice.
The sensational nature of reports of Two-Spirit peoples and the hatred they contained were used to try to justify genocide, theft of land and the dismantling of Native culture and religion. In Panama, explorer Vasco Nunez de Balboa threw a King and forty others of a Native tribe to be eaten by his dogs, because they crossdressed or had same-sex partners. Spaniards committed similar genocides in the Antilles and Louisiana. In those areas where Two-Spirit traditions survived, they were later driven underground or supplanted completely by missionary teachings and residential schools, both of which were bent on destroying Native culture.
Inuit FTMs serve White Whale Woman, who was believed to have been transformed into a man or woman-man.
South America
In South America, MTF priestesses have been found among the Araucanians (southern Chile and Argentina) and Mapuche, although after oppressive Spanish contact, they were largely replaced by female preistesses. Some females in the Tupinamba tribe lived as men, hunted and went to war. In 1576, explorer Pedro de Magalhaes recorded this, and recalling the Greek legend of the Amazons, named the Amazon river for these Tupinamba. For the Yoruba (Brazil), the deity Shango is represented as all sexes.
Unclear, But Present
Although it's doubtful that all of these traditions had a common origin, and possible that some of these are trans only by coincidence, there do seem to be a number of similar themes tying them together. Sorting through them to find specific motives and beliefs is impossible, though, because so little of the original traditions was recorded or survived the various book purges over time. It is only possible to speculate.
Alas, history is written by the victors, and the victors were largely not transgender or homosexual / bisexual persons."