It can be due to a cramp, injury, or other cause. Leg pain can be due to a muscle cramp (also called a charley horse). Common causes of cramps include: 1  Dehydration or low amounts of potassium, sodium, calcium, or magnesium in the blood.  Medicines (such as diuretics and statins)