Monkeys eat leaves, which contain plenty of cellulose.
Cellulose is a sugar formation which cannot be digested by humans.
Cellulose needs to be broken down into simple sugars to be digested.
Some bacteries are able to break down cellulose into simple sugars which can be digested then.
In soil, there are bacteries which can break down cellulose.
Thus, when monkeys eat soil, they consume bacteries in it which help break down cellulose from leaves they are eating into simple sugars to be used by body.
This simple yet effective method shows that monkeys arent eating soil just because of some minerals in it, but it is actually crucial for them to be able to digest cellulose in leaves.