Here's how to help prevent hoarseness, according to Northwestern University:
Drink plenty of water.
Quit smoking, and avoid secondhand smoke.
If you must talk loudly or yell, try to keep it brief.
If you must whisper, also keep it brief. Whispering is as bad for your voice as talking loudly.
Keep alcohol and caffeine consumption to a minimum.
Avoid spicy foods.