Plants have thorns as a form of defense mechanism to protect themselves from herbivores or other animals that may try to eat them or damage their leaves. Thorns act as a deterrent to prevent animals from feeding on the plant, helping the plant to survive and thrive in its environment.