It's a fairly complex question.
For instance, Hobbes (1585-1679) started with a belief in a state of nature before civilized gathering. Natural rights were grounded in individual autonomy (literally, "self-law"). The counter to this natural claim was the same right of others, resulting in what he called
Bellum omnium contra omnes ("war of all against all").
So the social contract comes into play: people bargained for safety and gave up some claims to autonomy.
This is sort of the background theory found at the time of the American Revolution. Note well, the fundamental source of "natural rights" is the concept of unfettered autonomy voluntarily bargained away for some manageable sense of order.
So, that form of "natural rights" have more in common with "In those days there was no king in Israel: every man did that which was right in his own eyes." ( Jdg 21:25) than with principle.
Grotius (1583-1645), on the other hand, introduced a different form of individuals' natural rights. He began with self-preservation and derived other natural rights from this. This is consistent with the three posts above.
But Grotius was trying to establish moral consensus in the presence of religious plurality. He sought a set of fundamental laws common to all people, that "even if we were to concede what we cannot concede without the utmost wickedness, that there is no God, these laws would still hold." In the 16th and 17th centuries, this was a radical concept because it implied that the people themselves were sovereign. As time went on, however, the idea took hold, especially in the period leading up to the American Revolution.
I think we see the same debate keep coming up over time. Theonomy, to a large extent, was a reaction against empirical Hobbesianism. So-called R2K discussions echo Grotius. The preamble to the US Constitution seeks to accommodate the social contract theory and the Grotius theory by emphasizing (among other things) common defense and blessings of liberty:
We the People of the United States, in Order to form a more perfect Union, establish Justice, insure domestic Tranquility, provide for the common defense, promote the general Welfare, and secure the Blessings of Liberty to ourselves and our Posterity, do ordain and establish this Constitution for the United States of America.
The Declaration of Independence is more explicit in steering away from Hobbes and grounding rights on Creation by asserting a "self-evident" truth that "all men are created equal, that they are endowed by their Creator with certain unalienable Rights." It also draws on the term of art "law of nature and nature's God," which to the trained ear of the time, meant the Law of God as articulated in Scripture.
So it's a mixed bag, and in our time there is a lot of baggage contained in the term "natural rights." I suspect that most folks nowadays prefer the antinomian-autonomy notion.