We don't need to go so back far in time: mandatory genital inspections (in the sense of, if you don't do it, you can't get legally married) arose in Victoria, Australia, prior to same-sex marriage legalization in Australia (in 2017). If you transitioned and wished to update your birth certificate, you needed to:
Attach either:
- Statutory declarations from two separate medical practitioners verifying that you have had sex affirmation surgery, or
- A current interstate recognition certificate issued by that state. The certificate must identify you as being of a particular sex.
Change your recorded sex, Births, Deaths, and Marriages (archived 2019)
So genital inspections were a requirement in Victoria for changing one's sex on their Victorian birth certificate (up to around 2020), which was a requirement for marriage. (Nowadays, you can change your sex descriptor to almost anything without surgery.)
Generally a surgeon performing the operation will provide a certificate. However, if you went overseas for the surgery, their documents were not considered acceptable: they had to have an Australian medical registration number.
By the looks of webpages like transhub, comparable legislation was in place in New South Wales, and doctors (at least the ones trans people would go to about such matters) tried to minimize the discomfort resulting from these genital inspections:
Some doctors will ask their patient to explain the details of the
surgery that was undertaken and what was involved, minimising the need
for a physical examination. Some doctors also talk with their patient
about what is involved with a medical examination and other reasons it
can be helpful, apart from legal gender affirmation. For example,
doing a genital examination post-operatively to assess for
complications or wound healing as part of post-surgical care.
In any case, GRS is major surgery, and to get it you'll go through a series of tests (physiological and psychological) over a long period of time (see the WPATH Standards of Care). If GRS is mandatory for something, then one way or another many physical exams are mandatory too.
Nevertheless, this is a comparatively rare scenario. Most people getting married in Australia did not have this step.
A totally separate instance of premarital medical checks is: prior to 2003, China used to have mandatory 婚前检查 (premarital checkups):
In China, couples hoping to marry must undergo a physical check before being granted a marriage certificate.
"The medical check is the sole criterion for finding whether the couple is healthy or otherwise. We only give licenses to couples who pass the check," said Zhou Jixiang of the Shanghai Civil Affairs Bureau which is in charge of issuing marriage certificates.
Premarital Test Revised, China.org.cn, 2002.
They'd check all sorts of things. Therese Hesketh published her experience and analysis in the British Medical Journal (2003):
My main memories of the examination are of
detailed questions about illness in first and second
degree relatives, being examined fully clothed (it was
winter and there was no heating), and being led into a
room with other women undergoing the examination
for a far from private pelvic examination. Then there
was the peeing into a little plastic cup in the very
insalubrious public toilet on the street outside before
walking back into the hospital amid the crush of
outpatients, trying to avoid any spillage. Two days later
the certificate of health for marriage was duly awarded.
My understanding is that these checkups are voluntary nowadays.