Yes, the title is a bit jokey (but attention grabbing, no?), but seriously...
For most of Western history men wore pants and women wore much looser clothing in the form of robes, gowns, dresses, and skirts. The idea of pants as male gendered clothing was heavily baked into the culture all throughout Europe and other parts of the world. It's only begining in the 19th Century that we first start seeing women wearing pants, to the point it's notable as distinctly desgined for women and not used as a disguise.
From what I can tell, pants first became acceptable for women to wear under their skirts so they didn't show any of the naughty bits like their kneecaps when riding horses, and it seems to have grown from there, and even have been a major part of 19th Century Feminist activism. In fact, 'bloomers' are named after Amelia Bloomer, a suffragette who designed them herself.
So, how did we get from dresses to denim?
I don't recall who wrote it, but there was a comment in this sub recently about how prostitutes have worn men's clothing for a long time, from Ancient Rome to Renaissance Italy. Here's an example of the
Various explanations can be offered for this practice, but given that as early as 1260 Florentine prostitutes were expelled from the city for having short hair and wearing male clothing, it was evidently a tradition of some standing. In the case of the fifteenth- and sixteenth-century Venice, there is evidence to suggest that the trend was at least in part linked to the widespread popularity of male sodomitic relationships...^1
But there are factors other than sex at play. One, in particular, was women's rights. Two excellent examples, separated by a century, are Elizabeth Smith Miller, a 19th century suffragette and abolitionist; and Luisa Capetillo, a 20th century Puerto Rican anarchist, feminist, and labor leader. Miller was known for her "Bloomer" costume, which consisted of [a knee length skirt and a pair of Turkish pantaloons.](https://www.nps.gov/wori/learn/historyculture/images/bloomers_1. Capetillo was famously arrested in Cuba, 1915, for wearing a men's suit in public, and while she was acquitted, she was still deported for involvement in a worker's strike.
The impetus to wear pants wasn't just about comfort, or style; it was predicated on the idea that control over a person's dress is just a facet of the broader control of gender oppression. These movements were intertwined with broader social justice movements, such as abolition or unionization.^2
Fashion designers also did their part to make it work. 1950s and 60s London was a central part of the development of gender parity in dress, Designers like André Courrèges and Mary Quant began to experiment, as the roots of the sexual revolution began to take hold.^4 Affordable clothing became a focus, and styles specifically for younger women were developed; Courrèges would soon become one of the first designers to create pants specifically for women.^5
So I would say that, while women wearing men's clothing is a storied tradition stretching back thousands of years, social activists laid the roots for women to wear pants in the 19th and early 20th centuries, allowing it to become a popular style in the late 1950s and early 60s.
Sources: