“HICCUPS are a vestigial motor reflex pattern (of glottal closure during inhalation, so that the vocal folds slam shut) left over from early tetrapod vertebrates, specifically the tadpole larvae of amphibians. Tadpoles undergo a ventilatory transformation from external filamentous gills to pulmonary respiration, with a consequent need to close lungs to avoid ingesting water, which is diverted to gills instead.”
https://evolution-outreach.springeropen.com/articles/10.1186/s12052-014-0012-5