Injuries, poor blood flow, overuse, spinal nerve compression and dehydration can cause leg cramps or spasms, according to Healthline. Leg spasms, often called "charley horses," also occur in people with low levels of certain minerals, such as potassium, sodium and calcium.
Athletes, infants, individuals who are obese or overweight, and the elderly tend to be more prone to muscle spasms, but they can happen to anyone regardless of age, states Healthline. When cramping is related to exercise, relaxing the muscle through massage and light stretching can relieve the contractions. Heating pads help relax muscles, and ice packs or ibuprofen can help relieve pain. Individuals who suffer from frequent spasms may benefit from physical therapy, and a doctor may prescribe anti-spasmodic medication. In severe cases, doctors may recommend surgery to relieve pressure on the impacted nerves.
Drinking plenty of water and beverages with electrolytes, such as Gatorade, can help prevent muscle spasms, as Healthline explains. People who exercise should stretch before and after exercise sessions as well as before bed. Additionally, active people should refrain from exerting the same muscles for two consecutive days or exercising in extremely hot or cold weather. Individuals who take diuretics, vitamin B or other supplements should consult a medical professional because many supplements interact negatively with other medications and essential nutrients.