Plants develop thorns as a defense mechanism to protect themselves from being eaten by herbivores or to deter animals from damaging them. Thorns act as a physical barrier that makes it difficult for animals to consume the plant, thereby increasing the plant's chances of survival.