The single most important purpose of wearing leg warmers in dance class is to prevent injuries that occur when muscles are not properly warmed up. Because dance classes feature a progression that starts with a warm up followed by stretching and then demanding muscular exercises, injuries such as pulled muscles and ligaments are common if a dancer has not properly prepared her muscles. Leg warmers provide extra heat to the feet, legs, ankles and calves in addition to the warmth that is generated through a warm up, therefore helping to avoid injuries associated with improper warm-ups. Leg warmers are also helpful at insulating injury prone areas. This is why in some cases you may see dancers wearing only one leg warmer to prevent a recurring injury on one leg (See Reference 1.)
As the name suggests, another main function of the leg warmer is to preserve warmth in the lower body muscles. While a dance class does typically start with a cardiovascular warm-up, if a dancer or teacher is pressed for time during a class or rehearsal it may be left up to the dancer to warm up and stretch themselves. In this case, leg warmers are usually worn for the duration of the class or rehearsal to preserve the warmth garnered during the warm-up throughout the session which may feature many stops and starts which can be damaging to cold muscles.
Leg warmers also serve the purpose of providing comfort, either emotional or physical, to the dancer who wears them. Some ballet dancers, for example, can feel exposed wearing only a leotard and tights, so leg warmers are an acceptable option to add more coverage to one's ensemble. Physically, certain leg warmer materials (such as those made with a significant amount of lycra) not only serve to keep muscles warm but can also be readjusted and concentrated to one area (such as bunched at the ankles or pulled over the upper thighs) if a dancer has a problem area that may be sore (See Reference 2.)
While it is uncommon that a professional dancer will don a pair of leg warmers for the purpose of fashion only, it is not uncommon amongst amateur, recreational and young dancers who seek to emulate the image of a dancer as popularized by pop culture. In the 1980s (See Reference 3) leg warmers became popular outside the dance studio as street wear and the trend has popped up again in recent years. For fashion purposes, leg warmers come in many wild colors and prints that would not typically be accepted in a professional atmosphere but that are tolerated amongst young and inexperienced dancers.