Many things can cause leg cramps. Most people are magnesium deficient, which is one cause. If you decide to take magnesium, choose a good supplement, not the cheapo magnesium oxide, which is only absorbed at about 4%.
MInimum daily requirement is 450mg daily. I take Innovix brand that contains magnesium glycinate and magnesium malate. And you can make highly absorbable magnesium water, but that's another story for later if anyone wants to know.
Gary Crowley has helped a lot of people with various types of pain. Here are 3 of his, regarding plantar fasciitis: