The following excerpt explains Dr Walker's attire.
During her work as a surgeon in the war, Walker often crossed battle lines to care for soldiers and civilians. In April of 1864, Walker had just finished helping a Confederate doctor with a surgery when she was captured by Confederate troops as a spy. She was held as a prisoner of war for four months. While imprisoned, she refused to wear the women’s clothes provided to her. She wore men’s clothes her entire life because they were more comfortable and hygienic. She even wore pants under her skirt at her wedding. Walker was released from prison in August of 1864 and became the assistant surgeon of the Ohio 52
nd Infantry a month later. After the war, Walker was awarded the Presidential Medal of Honor by President Andrew Johnson. A few years later, Walker published a book called
Hit in 1871.
In addition to her work with the army, she began to advocate for women’s rights. She famously wore pants and advocated for “dress reform.” She was arrested in New Orleans in 1870 because she was dressed like a man. Walker responded by saying, "I don't wear men's clothes, I wear my own clothes."
https://www.womenshistory.org/education-resources/biographies/mary-edwards-walker