Please explain why pilocarpine is used in glaucoma?

Because it works. Pilocarpine is the oldest medication for glaucoma. It reduces pressure by increasing the outflow of aqueous humor from the eye. It has a lot of side-effects and must be used 3-4 times per day.