Does good hydration or eating a banana or taking an S-cap help prevent muscle cramps? Martin Schwellnus has a new review (citation below) that finds little evidence for these traditional explanations/therapies. Schwellnus also reviews the neuromuscular control model that he developed in the late 90s, which suggests that cramping is due to a spinal reflex in response to muscle fatigue during/following intense exercise.
A good summary of the competing models (part I, part II, part III, part V) is on the Science of Sport blog. Read these and the comments. If you only read one read, part V and the comments.
Schwellnus also recommends passive stretching of the model to at least temporarily relieve the cramp since this causes a spinal reflex that relaxes the tensed (cramped) muscle. A recent chapter in the Olympic Textbook of Medicine in Sport, which includes Schwellnus as an author, recommends regular stretching of the muscles that generally cramp and proper carbohydrate and fluid intake prior to exercise (in order to delay muscle fatigue, not because this directly decreases probability of cramping).
Schwellnus, M P
Cause of Exercise Associated Muscle Cramps (EAMC) -- altered neuromuscular control, dehydration or electrolyte depletion?
Br J Sports Med 2009 43: 401-408