Although the division of labour is an evolutionary innovation that predates humankind (for instance among ants and bees), it was humans who first developed the practice of division of labour between groups. Groups of ants or other animal species may fight each other, but only human groups co-operate, and the possibility for this rests squarely upon the groupish propensity to exchange allied to reciprocal altruism.
The division of labour between groups that led to or was driven by trade 300,000 or more years ago was perfectly in accord with Ricardo's Law of Comparative Advantage, which says at its simplest that each group should do only what it is best at, and rely on trade for everything else it needs. The relative competence of a group may be assisted or constrained by its environment (raw materials etc), but even on a completely level playing field two groups will collectively achieve the best result if each one becomes a specialist in a particular technique, rather than trying to compete against each other. This is the basic argument for free trade.
Free trade didn't have to evolve as such, because Ricardo's Law stands even in the absence of human beings; but human groups evolved in such a way as to be able to take advantage of the Law. However the practice of free trade has been distorted in modern times by the nation state, which is driven by the desire to increase its own power, or by the short-sightedness of a narrow merchantilist class which appeals to that power for protection against the market (representing groupish human nature). This is of course one of the key messages of Adam Smith's The Wealth of Nations.