To ease an ab cramp, start by resting and gently massaging your abdominal muscles, this should help improve blood flow. You can also apply heat, like a warm pack, to relax the muscles. To avoid it altogether, do your best to stay hydrated by drinking plenty of water or electrolyte-rich sports drinks in moderation. If the cramp won't go away, then see a doctor as soon as you can.