Plants are constantly defending themselves from attack from pests and pathogens. Like animals, plants have physical and chemical defences which help to prevent infection and disease.
Many plants are covered with a thick bark. This is an external layer of dead cells which forms a physical barrier against infection. In this way it is very much like our skin. Leaves are covered with waxy cuticle which also helps to prevent their cells from becoming infected
Beyond bark and the waxy cuticle, each plant cell has a cellulose cell wall which acts as another barrier against infection. Some pathogens overcome this barrier by releasing enzymes that soften the cell wall.
Plants like roses have evolved large thorns to avoid being eaten, while plants like cacti have evolved thin spines. These adaptations protect plants from damage from pests and from disease from pathogens carried by pests.
The Mimosa pudica plant is very special. It has evolved to close its leaves and then point its stems towards the ground when touched by an insect as it lands on it. This movement is a defence mechanism which acts to dislodge any insect that rests on it. You can see this happen below.
Sometimes physical defences are not enough to protect a plant. Physical barriers alone will often not be enough of a deterrent against plant eating pests for example.
Some plants, like stinging nettles and foxgloves, have developed poisons to deter herbivores from eating them. They produce these constantly. These do not defend plants from infection by pathogens.
Other plants produce toxins in response to being attacked, for example, some plants release a toxin into the air when attacked by aphids. This toxin acts as a warning to other aphids, causing them to fly away.
As a way of defending themselves against pathogens, some plants such as mint and witch hazel produce antibacterial chemicals. These kill bacteria that were not stopped by physical defences. We now use these chemical defences in antiseptics for humans.
Farmers can now genetically engineer crop plants to be resistant to infections.