According to Rousseau, for the State, it is important that each citizen has some kind of religion or devotion as a regularizing rod for his behavior. It does not matter to the State if the religion is uplifting the citizen in any way or not. Its requirement is that it controls and shapes his behavior in the right way, so that he is not a nuisance in the society and remains a law-abiding citizen. Morality is the other side of the religious coin.
It is interesting to note that much of what we call 'morality' today did not exist in the Stone Age. The powerful took away what they needed from the hapless unfortunate creatures, who either perished or got enslaved. It was the jungle law, what prevails today in most of the animal kingdom, though there are interesting exceptions. As man became increasingly aware of his society, community and responsibility towards them, a kind of bond formed around him, making him an integral part of it and certain rules and conditions were either imposed on him, or he became conscious that to adhere to them would be self-preservation from harmful attacks. The individualist nature has resulted in the collective way of life and man found security in numbers and lived as part of a society, where morality became the most important requirement to have a coherent social structure. Social contract theory is supposed to be as old as Philosophy itself and even Socrates' explanation to Crito approaches it.
Rousseau comes very close to Hobbes when he says that religion binds the man to morality, law and hence, to social contract. This is helpful for the peace and well being of the society. It glorifies the prince, the country, and the lawmakers.
Hence, it is a form of social contract entered between the individual man and the collective society, which later was governed and protected by political authority. Man and society are bound by this unseen contract and it is easy to assume that morality and social contract are complimentary as well as prerequisites to each other.
"Social contracts or Contractarianism stems from the political power and control and man's accepting it as legitimate authority in governance of moral fibre of the society." http://plato.stanford.edu/entries/contractarianism/
According to Hobbes, it is clear that common interest of fear leads men into political society and fear could be of gory death, insecurity, lack of cultural living, deprivation of comfort and industry, losing satisfaction derived out of life, losing kin and possessions, living with unfulfilled desires, separation, misadventure and hatred ruling every bit of life. Hobbs feels that even a bad political authority is better than none and should be welcomed and cherished.