Enlightenment philosophers used the idea of a contract as a way to imagine how government got its start in human society and to imagine the basis of government's legitimacy.
To Enlightenment thinkers like Locke and Rousseau, human beings entered into a form of contract with one another when they created government. They promised to obey their government. In return, the government promised to protect the people's basic human rights. Government was, to these thinkers, legitimate because of this contract. If the government broke its part of the contract, if it did not protect the rights of the people, the contract was void and the people had the right to rebel.
In this way, these thinkers used the idea of a contract to understand the origins of government and the source of its legitimacy.