Hiccups occur when your muscles contracts involuntarily and repeatedly. During this time, the opening in your vocal cords close the passage for air and thus the hiccup sound is heard.
What Causes Hiccups and How to Prevent Them

Hiccups occur when your muscles contracts involuntarily and repeatedly. During this time, the opening in your vocal cords close the passage for air and thus the hiccup sound is heard.