Under feudalism royalty owned all of the land. In payment for using the land peasants spent their lives paying off the debt. The purpose of the government was to maintain this relationship, whether that necessitated keeping the population happy or fearful.
In contrast to this, Hobbes, Locke, and Hume presupposed that royalty are not more important than anyone else, and the existence of a government is only justified if it represents the interests of the people it governs.
Adam Smith accepts these assumptions, but as the Industrial Revolution was ramping up, the question of poverty, already mentioned in Hume, became more prominent. Everyone is essentially equal, and given a similar upbringing, there would be little difference between the philosopher and the beggar. The reason why they become so different is their habits.
Implicit in Adam Smith’s texts (and sometimes explicit), is the recognition that the poor commit more crime than the rich. This is the background of Smith’s discussion of justice. In agreement with Hume, to some extent at least, justice is necessary for the cohesion of society. While the other virtues, like friendship and generosity, are preferable, they are optional. Society can continue without them.
A just society recognizes that people care much more about their own interests and property than those of others. When an injustice is struck upon us, we want revenge. Even as a society, we expect that justice is served upon those who harm others. Murder is the worst kind of injustice. Theft or property damage is not as important, but still essential to the integrity of society, as is the breach of contract.
A society without great property is harmed much less by breach of contract or theft, and one is rarely motivated to harm someone else, but a society with significant inequality results in the (lazy) poor wanting to steal the property that the rich worked hard to accumulate. The government is necessary in a country with significant property in order to protect the safety and property of the wealthy.
In a separate text Smith argues that the poor are most advantaged by the division of labor, and key piece of the industrial revolution. By developing a specific skill everyone in society has the ability to create excess that can be exchanged with their neighbors for the goods necessary to meet each of their individual needs. Under feudalism peasants worked all day to barely meet their needs. In the industrial revolution workers could create thousands of widgets to be exchanged on the free market. Through the division of labor thousands (or millions) of people in a society have the ability to create comfort and convenience, even the lowest ranks of society, never before possible by utilizing the labor of all of the inter-dependent working parts of the economy. No one living under the division of labor would prefer to live in the state of nature where they must rely upon themselves to meet each of their needs. Under the division of labor all of this happens unintentionally through the invisible hand. Self-interested actions overlap to create a society that fulfills the interests of everyone.