Durkheim, writing towards the end of the 19th C studied the role of religion in societies.
From these studies came the belief that social order was a product of shared beliefs, values, norms and traditions within society. He called these the 'collective conscience' which through their shared nature led to conformity of thought and behaviour.
These shared beliefs and values brought with them a sense of social solidarity, working together for the common good. Conformity is rewarded by society, whereas non-conformity receives sanctions.
This social solidarity is both formed and encouraged by institutions such as education, law, religion, government, the family - they all have a role to play in creating and maintaining the consensus - as individuals we participate in these institutions and are therefore part of that process.
Change within society is possible where everyone consents to it, if change is too rapid then confusion follows, a sense of disconnect from society; Durkheim calls this 'anomie'
You can find more on Durkheim at the excellent ThoughtCo site
https://www.thoughtco.com