At one level, laws can be seen as a type of rule which is meant to govern behaviour between people.
Many organisations use rules to govern behaviour between people.
Families may have rules about keeping one's bedroom tidy or not staying out late. Schools have rules about doing homework and not running in corridors. So, rules seem to be an almost inevitable part of any organised social interaction, and societies have almost always developed such rules. Primitive societies will have relatively few formal rules, and such rules as exist will often be derived from other moral codes such as religion. So, a prohibition on murder and theft may exist, but it may be left to individuals to decide what other arrangements they should make for themselves.