Laws are usually made with the idea of protecting people. When there is a threat to the society, the legislative branch makes a law to protect the people. Sometimes the laws are more harsh but sometimes they are liberating. What the laws are usually depends on what the social consensus is on various issues and these are usually based on the current understanding of morals and ethics.