Counting and the invention of numbers and the abstractions enabling mathematics are surely cognitive abilities. Counting itself involves an abstract ability. The simple act of raising two fingers to denote the number of stones or lions or stars implies first, the abstract ability to describe an observed quality and second, the desire to communicate that observation.
What led humans to counting and when?
Before an intelligence can turn to counting it must first have some concept of numbers. When and how did our ancient ancestors first develop a concept of numbers and then start counting? ……..
It seems clear that many animals do distinguish – in a primitive and elementary way – between “more” and “less, and “few” and “many”,and “bigger” and “smaller”, and even manage to distinguish between simple number counts. They show a sophisticated use of hierarchy and precedence.
Some primates show some primitive abilities when tested by humans
….. Rhesus monkeys appear to understand that 1 + 1 = 2. They also seem to understand that 2 + 1 = 3, 2 – 1 = 1, and 3 – 1 = 2—but fail, however, to understand that 2 + 2 = 4. ……
But even chimpanzees and monkeys rarely, if ever, use counts or counting in interactions among themselves. The abilities for language and counting are not necessarily connected genetically (though it is probable), but they are both certainly abilities which appear gradually as cognition increases. Mathematics is, of course, just another language for describing the world around us. Number systems, as all invented languages, need that a system and its rules be shared before any communication is feasible. It is very likely that the expressions of the abilities to count and to have language follow much the same timeline. The invention of specific sounds or gestures to signify words surely coincided with the invention of gestures or sounds to signify numbers. The step change in the size of brains along the evolutionary path of humans is very likely closely connected with the expressions of the language and the counting abilities.

The ability to have language surely preceded the invention of languages just as the ability to count preceded the expressions of counting and numbering. It is not implausible that the first member of a homo erectus descendant who used his fingers to indicate one of something, or four of something else, to one of his peers, made a far, far greater discovery – relatively – than Newton or Einstein ever did.
We must have started counting and using counts (using gestures) long before we invented words to represent counts. Of course, it is the desire to communicate which is the driving force which takes us from having abilities to expressions of those abilities. The “cooperation gene” goes back to before the development of bipedalism and before the split with chimpanzees or even gorillas (at least 9 million years ago).
The simple answer to the question “Why did we start to count?” is because we could conceive of a count, observed it and wished to communicate it. But this presupposes the ability to count. Just as with language, the ability and the expression of the ability, are a consequence of the rapid increase in brain size which happened between 3 m and 1 m years ago.
I am persuaded that that rapid change was due to the control of fire and the change to eating cooked food and especially cooked meat. The digestion of many nutrients becomes possible only with cooked food and is the most plausible driver for the rapid increase in brain size.
Raw Food not enough to feed big brains
………. our brains would still be the size of an ape’s if H. erectus hadn’t played with fire: “Gorillas are stuck with this limitation of how much they can eat in a day; orangutans are stuck there; H. erectus would be stuck there if they had not invented cooking,” she says. “The more I think about it, the more I bow to my kitchen. It’s the reason we are here.”