I get cramps when the inflammation in my joints is on a high level. I can stretch my foot and every time it starts cramping. When the inflammation calms down a bit, the cramping becomes less.
For me, there is no link between cramps and Magnesium. I always take Calcium supplements due to osteopenia so I don't know what would happen if I did not take them.
Maybe you should give Magnesium and Calcium a try but if it does not improve you should see your doctor, to my mind.