While there's no direct link between specific foods and leg cramps, deficiencies in certain minerals—such as potassium, magnesium, and calcium—can contribute to leg cramps.