Ricardo’s law was framed for international trade, but it is equally true for two individuals also.
Suppose there are two persons A and B. A produces 10 pieces of Article 1 in one day and produces 8 pieces of article 2 in one day.
B produces 5 pieces of article 1 in one day and 6 pieces of article 2 in one day.
Both work for two days and each produces both articles.
A = 10 and 8
B= 5 and 6
Total article 1= 15, article 2=14 Total production 29 pieces
If on both days A produces only article 1 and B produces only article 2
Then A= 10+10= 20
B= 6+6= 12
Total production 32 articles. The two persons working together have become more productive, that is productivity per capita has increased for the society of these two persons as a whole.
So, the total production has increased by the division of labour. This happened even though A was more productive in both the articles than B. This holds true for two individuals, two households, two villages, two cities, or two countries, and for very large number of commodities and for large number of individuals. Total production will always increase when each produces only what he is better at among his various skills, instead of producing everything himself.
Division of labour assumes that production of each of them is safe, and they are free to trade, because they will need to trade their produce and buy what they do not produce themselves.
Cities always continue to grow in size because they facilitate division of labour. Trade is essential because only it makes division of labour possible.
It also doesn’t tell who will produce what. A person can produce anything so long as he is able to supply it cheaper than everybody else. That is, at more efficiency than everybody else. This will force people to do something for which there is an unmet demand or current cost is higher than what it will be if they produce it. That way, it is cruel, it is heartless, it forces a person to do what is required by others, not what he likes to do. But it also gives choice: you can opt out and do whatever you like, so long as you produce everything that you need yourself. Only consequence will be that you will always be poor. If you want to grow rich, you will have to participate in division of labour, and in trade, and hence will have to do not what you like, but what is you are best at among various things that you can do. Or you will need to become more skilful than others in one of the production activity.
Division of labour also means that a person is producing only one thing, so he becomes ever more skilful in that, and is able to beat competition.
That is how a society that ensures safety of private property and allows full freedom of trade and allows everybody to produce whatever he wishes becomes ever more efficient and hence richer and richer.
And it is also clear that when these conditions are not present, the society’s productivity will not grow. That is, private property is not safe, or trade is not free or safe, or government/some other system decides who will produce what; then society will always remain poor.
That is all to it. This is the only cause of prosperity or poverty. Nothing else.