Hiccups are an interesting reflex that involves nerves in the diaphram (the muscle between the lungs and the stomach that is involved in breathing). When these nerves are stimulated, they can cause the diaphram to contract suddenly and repeatedly, and this causes the hiccups.
Most of the time hiccups are brought on by some stimulus that irritates nerves in the stomach or esophagus, leading to triggering of the hiccup reflex. The most common causes of this are things that cause stretching or mechanical irritation of the stomach. So, for example, hiccups are really common after overeating. They may also be brought on by alcohol, tobacco, spicy foods, and carbonated beverages. Attacks of hiccups can last minutes to hours.
You should go see your primary care doctor
about this issue. Although most of the time hiccups are caused by the things I mention above, sometimes (rarely) they can be a sign of a more serious medical problem, such as an imbalance of certain chemicals in your blood stream, diabetes, or a problem with your kidneys. Your doctor will be able to make sure none of these serious things are going on and, assuming not, help you identify which of the above triggers is causing your hiccup attacks. There are no particular medications or treatments that are used for hiccup attacks; rather, identifying and avoiding the triggers is the way to go.