Unnecessary muscle tension is one cause. A swim coach from way back told me to not point my toes so much (contrary to what everyone else had told me to to) since it created too much tension in the foot muscles, causing cramps.
Stretch before and after swimming (yes -- stretch your feet! try heel raises, towel stretches, flex/relaxing toes) and make sure you diet has adequate potassium. If you are eating a high-protein diet or working out really hard, there's a chance your diet is low on calcium, magnesium, and potassium -- all of which are necessary for proper muscle function --so add a good multivitamin or simply eat a banana a day ;)