According to John Locke, people give up their rights in the form of a social contract with other people for the protection of life, liberty, and property. Thomas Jefferson restated, or better yet, plagiarized Lockes ideas in the Declaration of Independence. The founders believed this social contract was in regards to the states since they were the first government over the people after independence was declared.
State governments have what is refered to as police power. This is the power to legislate for the health, safety, welfare, and morals of the community. The part about morals has been dropped. Basically, when legisatures get together to pass a bill, they first have to find out if they have the power.
The federal Congress looks in Article I, Section 8 for the enumerated powers. The State governments ask themselves if the bill promotes for the general health, safety, or welfare of the community. If it does, they can pass the bill, and that is police power.