Answer: This is the Social Contract Theory.
This theory says that people live in society and has to agree about some political rules and morals. This can be like the laws, or basic rules of coexistence . The obligation of the contract or agreement are dependent of the society that the people lives.