I don't think that logically follows. Magnesium might well be necessary for proper muscle function, but that doesn't mean that absence of magnesium causes a specific muscle behaviour (in this case, cramps). Even supposing that it's true that 'no magnesium = more likely to cramp', nobody has zero magnesium. A quick Pubmed search doesn't yield any papers linking magnesium with cramp prevention, but I'm happy to be corrected.