So many of the conventions that ruled how men and women interacted were "unwritten rules" that everyone understood, but were not legally codified. Conformity came from social pressure from the majority of people who just knew that "that's the way it is." Such was the dress code for the U.S. Senate that expected women to wear dresses long after those in other professions were wearing pantsuits, uniform pants, or jeans to work.
As the upper house in the U.S. legislature, the Senate has always been more formal and reserved than the House. Even during the 1980s, pants on women were apparently too much for that august chamber to handle. Individual Senate offices had their own rules, but on the floor, women wearing pants were verboten, which could necessitate quick changes. "We've heard from women staff that in the 1980s, if they came in to work—if they were called in on an emergency basis—they needed to keep a dress to put on quickly or they had to borrow one if they had to appear on the Senate floor," Richard A. Baker, Senate historian from 1975 to 2009, told The Washington Post in 2002.
While the dress code for the Senate was never officially codified, the norms were enforced by Senate doorkeepers, who controlled access to the chamber and served partly as security guards, partly as protocol monitors. Even today, they assess each person seeking entry, making sure they are supposed to be there and are dressed appropriately. The problem is that "dressed appropriately" has historically been up to the discretion of the doorkeeper on duty: Doorkeepers made determinations based on personal opinion or instructions from their boss, the sergeant at arms.
What did it take for the doorkeepers to back down over enforcing that dresses be worn by women senators? It took a critical number of concurrent women senators (six), and one breaking the unwritten rule in order to bring the entire subject up for discussion. Read how that finally happened in 1993 at mental_floss.