OCD can be inherited, with genetic factors contributing significantly to its development. However, environmental influences also play a part, meaning OCD is likely due to a combination of both genetics and environmental factors.