According to the Merriam-Webster’s Dictionary of English Usage this rule was first introduced in a rather tentative form in 1770, when the grammarian Robert Baker stated that less ‘is most commonly used as speaking of a Number; where I should think Fewer would be better’.
Same with less vs. fewer: