Social contract is an agreement that exists between the ruler and the ruled. Through the social contract, people yield some personal control to the ruler for collective control by the ruler.
In exchange ruler/governing structure takes up the responsibility of ensuring that the rights of people are protected from others who would seek to trample upon them and also to protect the nation.
The idea of the social contract was forwarded by Thomas Hobbes in his manuscript Leviathan.