Thorns are essentially defense mechanisms for the plant, much like teeth are for an animal. The sharp points protect the plant against animals that want to eat it.
Honey locust trees are a prime example of plants with thorns, according to The American Phytopathological Society. Thorns are actually a type of branch, and roses do not have true thorns. Instead, roses have prickles, which are a part of the skin of the plant. Cacti, on the other hand, have spines, which are a modified leaf. Overall, all of these types of growths on plants do the same thing; defend the plant against predators.