There is no known way to prevent OCD.
OCD is considered a chronic disorder. The course of the disorder is variable. Symptoms may come and go, ease over time, or grow progressively worse. Treatment should help the person learn to recognize symptoms before they become severe. If symptoms worsen, the individual may need to resume therapy or medicines.
OCD is not contagious. It does tend to run in families.