It's a cool insight that I just learned, but if the two gears share a multiple, then the same teeth will engage with each other over and over leading to uneven wear pattern. If the gears are relatively prime (e.g. 6 and 17) then each tooth will touch each other tooth before repeating the cycle.
Try it out on a piece of paper and see for yourself (that's what I did).
Presumably the desired condition is that gcd(n,m) = 1 (the number of teeth be relatively prime) so that each tooth of one gear meets with each tooth of the second gear, cyclically. If there are variations/defects in teeth, this might help them wear more uniformly.
In an ideal world every tooth on the gear is exactly the same, but in the real world they have slight differences that wear each tooth differently. So by having a prime number of teeth, the teeth of two gears don't mesh with the same teeth on the opposite in a short repeating pattern. The gear teeth wear more evenly this way and imperfections are worn off over time instead of worn in.