The herbalist skill is used by dwarves with the plant gathering labor. They will gather from designated shrubs and harvest plants.
Herbalists are often used to help with food production in an early fortress as they do not require farm plots or other setup. Above ground, this skill works best in areas with thick vegetation like forests and is nearly useless in sparsely vegetated biomes like deserts or badlands. Under ground, plant gathering can be a high risk activity in the caverns and production can be easily outstripped by farms. While plant gathering is less efficient than farming and significantly less reliable, it also requires minimal space and provides a relatively immediate payoff in comparison.
Plants gathered by herbalists can be eaten or processed to provide seeds which can then be planted in farms. For this reason, it is popular (if not necessary) to gather outdoor plants early in a fort's existence if one wants to grow outdoor crops.
Speed of training
Dwarves gain experience in plant gathering every time they pick over a shrub whether they are successful at harvesting anything or not. Training a completely unskilled dwarf to legendary status in this skill requires the harvesting of 600 plants, and can be done in less than a couple years. A legendary herbalist not suffering from any skill penalties will never fail to harvest a stack of four or five plants.