Economists frequently describe barter as a system that eventually evolved into money as a medium of exchange.

Adam Smith says that humans have a propensity to exchange, a drive to do so, which eventually over long periods of time leads to division of labour.

This division of labor, from which so many advantages are derived, is not originally the effect of any human wisdom, which foresees and intends that general opulence to which it gives occasion. It is the necessary, though very slow and gradual, consequence of a certain propensity in human nature which has in view no such extensive utility; the propensity to truck, barter, and exchange one thing for another.

Adam Smith, Wealth of nations, Chapter 2, Of the Principle which gives occasion to the Division of Labor

Smith’s argument is that the division of labour isn’t the result of human wisdom or a planned design. Instead, it emerges naturally because humans have a built in tendency to trade. Once people start exchanging goods, it becomes advantageous for individuals to specialize in making one thing and trade their extra/surplus for other goods, rather than trying to make everything themselves.

This way the barter system may have existed. For such an exchange, there needed to be a “double coincidence of wants” between 2 groups. This would have led to every exchange requiring multiple intermediary exchanges in most cases. To overcome the difficulty of double coincidence of wants, he claimed people would have stockpiled salt or metal - things that people would not refuse to help navigate the market smoothly. Cattle was a common instrument of commerce.

 If, on the contrary, instead of sheep or oxen, he had metals to give in exchange for it, he could easily proportion the quantity of the metal to the precise quantity of the commodity which he had immediate occasion for.

Wealth of Nations, Book I, Chapter IV

…and this eventually evolved into money.

But anthropological evidence says that barter was never used systemically within a society, and that it played little role in the emergence of money. Barter existed only between strangers or enemies and as a fallback when trust based credit or monetary exchange is unavailable, rather than a historical stage that came before money.