Kids in particular have a very active gag reflex and may cough so hard they throw up. Mucus in the chest can also contribute to vomiting if it builds up and triggers the gag reflex during coughing.