Calf and foot cramps are very common when you first start doing ground grappling or Brazilian Jiu-jitsu. I remember when I first started grappling, I experienced a few very crippling cramps, a couple of which were so bad that I was crying out in pain.
The best way to avoid them is to drink plenty of water before and while training. Many cramps arise as a result of dehydration. When cramps do arise, stop what you're doing, breathe and stretch out the muscle and drink some water. It's the same stretching technique whether it's your foot or your calf. Grab the ball of your foot and extend your leg out from the heel.
As you get stronger and your body becomes more accustomed to grappling / BJJ, the cramps will be come less frequent. I don't remember the last time I had one now.