Hermaphroditism isn't really a medical diagnosis but merely an ancient word describing overt morphology, originating largely in myth rather than experience (ex. Phanes/Eros, or alternatively the child of Hermes and Aphrodite, which is where the word actually comes from), and a catchall term for a variety of conditions, most of which never develop into the morphology people have in mind.
The statistics / references given by a poster earlier are fanciful because they don't take this into account ... that is, they don't take into account the fact that most people, even those with cases of mixed gonads, will never receive the label "hermaphrodite", either because not seeking medical attention, not being noticed by doctors, not wanting the label or the label being avoided, etc. Only in the rarest of the rare cases is the label ever used, and in those cases, although they may indeed have a uterine horn, menstrual cycle, etc. there are never two fully formed and functioning reproductive systems.
I've personally seen Swyer syndrome (an apparently normal female with full female features inside and out but with streak testes, an XY-female), as well as one definite case of trisomy mosaicism (infertile but presented as female, had somatic cells that are XX and others that are other karyotypes), and one case of I don't even know what (profound abnormalities including mental retardation and abnormal gonadal development, a small penis-like growth, vaginal-like pocket, abnormal labial development, facial hair etc.). Most people with these or other conditions no one will ever know about unless the person wants them too. Until fairly recently the person with the condition themselves may not have known or understood it.
The problem with the idea of natural biological true hermaphroditism, and why it's vanishingly rare, and why, contrary to futa-lovers' dreams, there are actually no cases of two fully formed and fully functioning reproductive systems of different sexes in one individual, is that it's the exact same initial tissues that, under different conditions, that develop into different systems. Even if you began with two different reasonably intact sets of tissues within one person, such as with zygote fusion / "twin tumor" / chimerism, which is already exceedingly rare, those different tissues would be subjected to the same overall systemic hormonal and genetic regulatory environment and so would develop similarly, with either the "masculine" tissues (XY?) remaining feminine or the "feminine" tissues (XX?) masculinizing.
You could theoretically develop both tissues "normally" by subjecting one of them to a separate developmental microenvironment such as by using targeted injections of viruses to turn on or off genes in the desired tissues and reset hormonal sensitivities (for example, by inducing selective androgen insensitivity?), but the problem is that this is all hypothetical, unethical, expensive, and probably wouldn't work anyway because the microenvironment couldn't be limited just to the desired tissues because of their proximity to the other gonads ... ie. if you tried to enlarge the "penile" tissue so that it developed normally, you'd also get clitoromegaly and abnormal labial development and so on. Or vice versa if you avoided that then you'd get micropenis, hypospadia, streak testes, etc. You could get around this I guess by sticking a dick on someone's head or chest but I don't think anyone wants that.
Plastic surgical interventions can obviously get around all of this, by turning anything into anything else, for example developing the clitoris into a penis, using the labia to form a scrotum, etc., but then the clitoris itself is gone, the "testes" don't actually produce sperm, etc.. Or for mtf you could form a "vaginal" pocket, etc. but not give a uterus. This all creates a functional male or female in terms of having sex and external appearance and so on, but obviously not in terms of actual reproductive capacity. Of course you could take a karyotypic and morphological female ("normal" biological female), start turning her into a man, and at some point help her birth kids, but you can't do the same for mtf.
Interestingly you can already have two normal biological women who are the joint genetic parents (no father) of their own children, but this obviously takes reproductive assistance. Each one of the two could get to be the "mommy" and the "daddy", with one child popping out of each birth canal. Again, though, as with mtf, men get the short end of the stick here, unable to do this.
One day, perhaps within just the next 20-30 years, it would be theoretically possible to have tissue regeneration, artificial tissue, artificial organ, and genetic technologies developed to the point that we could create bona fide functioning hermaprhodites. After all it does happen in other animals. But the way our society is going with rising inequality, social unrest, war, avarice, economic instability, climate change, fossil fuel war, miseducation, anti-intellectualism and hatred and distrust of science and scientists, etc. we'll probably collapse into a new dark age, or at least slow down the pace of medical development, before we ever get there. When and if we do get there it, and most genetic counseling or assistance, will probably be something only for the super-elite, and will involve other major social changes on the level of "Elysium" or beyond, including possibly a speciation-like event ala Brave New World where the mass of humanity are treated as chattel to their augmented cyber-supergenetic AI intellect augmented transhuman overlords: android futas?
In closure and summary, the basic ways something like hermaphroditism or transsexuality can occur are, in probable likely order of producing a true hermaphrodite: chimerism of some kind (inclusion cells from another somatic or germ line), SRY mutation or crossover, other abnormal karyotype, something involving selective androgen insensitivity, ??? something else?
EDIT: I almost forgot the entire group of FOX/fkh protein genes, which if better understood could maybe be part of the pathway to successful simultaneous development of two distinct functioning reproductive systems in the same organism. But that's probably a long ways away. Mutations of some genes regulating them could be involved in reproductive abnormalities. But the effects of most of these genes/proteins are generally so widespread that they have myriad other effects beyond just reproductive ones ... ex. grow a dick but get Klingon brow ridges.