I read that cramps in the calf muscle are due to bad kick technique. In short, they said it is wrong to actively point your toes during kick because this puts unnecessary tension on the calf muscle. Instead you should allow your ankles to relax and become floppy, allowing your feet to flap up and down naturally like flippers.
After suffering from cramp twice in a few weeks, I realised I was pointing my toes. I stopped it and I havent had cramps again since.
Obviously, in addition to this, you should make sure you are adequately hydrated before each session and also stretch out the calf muscles first. To stretch the calf muscle, do the exact opposite of pointing your toes, i.e. rotate the foot up and in towards you... you'll feel the stretch immediately.