It was part of the cultural changes that occurred in the early 20th Century.
Advertisements for depilatories for women can be found in magazines going back to the mid 19th Century. Women's fashions at that time covered most of a woman's body, so removing underarm or leg hair wasn't perceived as something necessary. However, advertisements of the time often marketed to women creams which would give them 'perfect complexions'. Part of the idea of the perfect complexion was not having hair anywhere but the top of the head. So women who were a little more hirsute than average would want a way to get rid of excess hair on their upper lip or forearms.
In the nineteen teens, women's fashions changed. A type of blouse colloquially referred to as a 'pneumonia blouse' became popular; they were extremely sheer and delicate, which meant that thick, dark underarm hair could be seen beneath them. Also, sleeveless evening dresses became fashionable, especially on the dance floor (ballroom dancing was a craze at this time.) These fads mostly occurred among the upper class. There were a number of popular women's magazines at the time, but Harper's Bazaar specifically targeted upper class women, and they were the first ones to run advertisements encouraging women to get rid of underarm hair.
[Here] (http://imgur.com/WrgTZmN) is the first known ad for underarm hair removal; it ran in Harper's Bazaar in May 1915. This was such a novel idea at the time that they don't even use the word shave; they refer to 'smoothing' women's skin. Shaving was something men did. This Gillette ad is from 1916; it was the first razor marketed especially to women. Again, no 'shave'. It referred to 'smoothing'.
I know you asked specifically about legs, but I wanted to explain where this started. By 1925, ads for underarm hair removal were common in women's magazines and middle class women had picked up the habit as well. As 1920's women shortened their skirts, these same magazine ads began to recommend removing leg hair. They would show images of women in short skirts or bathing suits with perfectly smooth, hairless legs. This Veet ad from 1924 is a great example. This one, also from 1924, specifically uses the word 'limbs' in the text, which was considered more feminine than 'legs'.
Women in the teens and twenties were going through a period of rapid social change which affected every aspect of their lives. They began to actively take part in the new consumer culture that was developing, and industries responded by making products especially for them. Women's magazines then advertised the products widely. Hair removal was marketed as a necessary female trait, and the offending hair was referred to in ads with words like objectionable, unsightly, or embarrassing, while hair-free women would be referred to as clean, dainty, and sanitary.
The ritual of removing female body hair became widespread by the 1940's, as these products became cheaper and hair-free female bodies began to be seen as normal. The practice went along with other behaviors which became common in the 1920's, like wearing makeup and trying to 'reduce' (lose weight). These things changed the concept of the feminine ideal in America.
Some sources:
The Body Project : An Intimate History of American Girls
Hope in a Jar: The Making of America's Beauty Culture
Caucasian Female Body Hair and American Culture, by Christina Hope. This was an article published in 2004 in the Journal of American Culture. I cannot find a copy of it online, but it is quite informative.
You may also be interested in this section of our Popular Questions wiki (the link is in the sidebar).