2 ways. Foods which are acidic or spicy can directly damage the voice box, and contribute to hoarseness. Other foods, like high fat foods, caffeine, and others, can contribute to reflux. Acid reflux is a very common cause of vocal cord problems.
Food and voice. Spicy food can cause reflux which could then cause the voice to sound hoarse. My singers who have reflux are unable to reach their high notes and have a lower range allergic reactions to foods can cause acute airway obstruction and death. Nut allergy is an example of this. Less intense reactions to foods and allergies can cause post nasal drip which can affect the voice. I hope this helps.