Muscle cramp during a race can be extremely painful. A involuntary spasm can occur that may affect your performance perhaps even forcing you to pull out.
As well as ensuring you train properly, taking the right hydration can also be a factor to minimise the chance of getting cramp. High 5 have a useful page on their website with more information. View here.