Such laws date back to 1887, according to Terry S. Kogan, a University of Utah law professor and a contributor to the book Toilet: Public Restrooms and the Politics of Sharing. One hundred and twenty-seven years ago, Massachusetts passed the first law mandating gender-segregated toilets, and many states quickly followed suit. Many of those laws have never been substantially modified, with obvious exceptions in progressive enclaves like D.C. and San Francisco, meaning that much of the United States’ toilet-related building codes reflect a literally Victorian prudishness that we might mock in other contexts.

These laws arose due to a confluence of several disparate contemporary movements, Kogan explains in Toilet. The centralization of labor in factories led to the centralization of human waste at work sites, which was carried away by recently developed plumbing technology that had itself been invented in response the newly realized germ theory of disease and the consequent sudden push to improve sanitation. Women’s growing presence in the factory workforce, and in public life more generally, triggered a paternalistic impulse to “protect” women from the full force of the world outside their homes, which manifested itself architecturally in a bizarro parallel world of spaces for women adjacent to but separate from men’s—ladies’ reading rooms at libraries, parlors at department stores, separate entrances at post offices and banks, and their own car on trains, intentionally placed at the very end so that male passengers could chivalrously bear the brunt in the event of a collision. The leap from parlors and reading rooms to ladies-only restrooms was not hard to make, although Kogan admits that “it is not at all obvious what led regulators to conclude that separating factory toilet facilities by sex would protect working women.” His research suggests that sex segregation was seen by regulators at the time as “a kind of cure-all” for the era’s social anxiety about working women.