William A. Whitelaw, a professor in the department of medicine at the University of Calgary, explains.
If a person gets hiccups and wants to know what has set them off, there is a long list of medical or physiological disorders that are associated with hiccups and seem to cause them. The most common by far is distension or expansion of the stomach and movement of stomach acid into the esophagus. After that, a disease or irritation in the thorax could be to blame. Irritation of the phrenic nerve (the nerve to the diaphragm) or the diaphragm is often cited as a cause of hiccups, but this is only speculation about the exact mechanism. Hiccups can also arise from a variety of neurological lesions, many of them involving the brain stem, or some metabolic disorders (particularly renal failure). Medications, often ones that promote acid reflux into the esophagus, and a variety of other disorders have also been linked to hiccups.
In medical practice, however, we do not start looking for any of these causes unless the hiccups are very persistent or if they came on very dramatically for no obvious reason. For ordinary bothersome hiccups that come back or stay longer than usual, treatment for stomach acid reflux is usually offered before other investigations are done.
In regards to the physiological process behind hiccuping, some information and speculations exist, but a complete answer has not yet been determined. A hiccup is not simply a twitch of the diaphragm but a complex motor act. During one, the diaphragm and the complete set of inspiratory muscles (intercostal muscles, neck muscles and others) make a sudden, very strong, contraction. The expiratory muscles are also strongly inhibited. Just after the contraction begins, the glottis (commonly called the vocal cords) clamp shut, making the "hic" sound. Before the diaphragm contracts, the roof of the mouth moves up, as does the back of the tongue, and there is often an associated burp. The heart slows a bit as well. In addition, hiccups are seldom isolated events but tend to recur every few seconds, sometimes for hours.
Together these observations imply that somewhere in the brain we have a "central pattern generator," or CPG, for hiccups. In other words, there is a neuronal circuit designed for generating hiccups similar to the ones we have for actions such as breathing, coughing and walking. And like most of those CPGs, it is an oscillator: it sends out a recurring, periodic signal to set off a hiccup. We don't have hiccups all the time, however, so the oscillator must be a "conditional oscillator" that fires only under certain conditions.
Hiccups are seen in a wide variety of animals and are very common in the fetus. They have been recorded physiologically in animal studies and are easily recognized on ultrasounds of human babies. Hiccups appear before breathing movements as the fetus develops and are common in newborns but gradually disappear over the next few months.