This is the best explaination I have seen, from ww.drmirkin.com:
It took years for the medical community to finally learn what causes a
side stitch. Suddenly a runner develops pain in the right upper part of
the belly, just underneath the ribs in the front. With each step the
pain worsens. Doctors proposed all sorts of explanations for side
stitch and most were nonsense. A stitch is not caused by gas in the
colon because it is not relived by passing gas. It is not caused by a
liver swollen with blood during running, because the liver has a very
distensible capsule and the liver does not enlarge that much during
exercise. It is not caused by cramps in the belly muscles because the
belly muscles are not held rigidly when you have a side stitch, and it
does not hurt when you push on the belly muscles. Lack of oxygen to the
diaphragm doesn't cause them because blood flow to the diaphragm is not
shut off by running. They are not caused by trapped gas in the lungs
because gas does not get trapped in the lungs during exercise.
Then along came Dr. Tim Noakes, a medical school professor from South
Africa, who offered the first reasonable explanation and a successful
treatment. Thick fibrous bands called ligaments extend downward from
your diaphragm to hold your liver in place. When you run, your liver
drops at the exact time that your diaphragm goes up, stretching the
ligaments and causing pain. Humans have a fixed pattern of breathing
when they run. They have a two to one breathing ratio, breathing once
for each two strides. Most people breathe out when the right foot
strikes the ground. When you breathe out, your diaphragm goes up, and
at the same time, the force of your foot strike causes your liver to go
down. This stretches the ligaments that attach the liver to your
diaphragm, causing pain. So the cause of a side stitch during hard
running is a stretching of the ligaments that hold the liver to the
diaphragm and the cure is to relieve the stretching of the ligaments.
When you get a stitch, stop running and press your hand deep into your
liver to raise it up against your diaphragm. At the same time, purse
your lips and blow out against the tightly held lips as hard as you
can. Pushing the liver up stops stretching the ligaments. Breathing out
hard empties your lungs. The pain is relieved immediately and you can
resume running as soon as the pain disappears. The pain usually will
not go away unless you stop running long enough to raise your liver.