Prevention depends on the cause. For instance, avoiding alcohol can prevent vomiting due to alcohol. Avoiding extreme exercise can prevent vomiting due to exercise. In most settings, vomiting cannot be avoided, but can often be treated.
Prolonged vomiting can lead to dehydration and salt imbalances. Most other long-term effects are related to the cause. For instance, food poisoning usually goes away within 48 hours and causes no long-term effects. On the other hand, cancer may result in death.
Vomiting itself is not contagious and poses no risk to others. However, if the cause is an infection, the infection may be contagious.