By experience over ages, by concern for family, society and nation. That is how the laws of Torah, Bible and Qur'an also were made. Do you think that before the time of Moses societies did not have any laws?
".. the modern scholarly consensus is that the biblical person of Moses is largely mythical while also holding that "a Moses-like figure may have existed somewhere in the southern Transjordan" in the mid-to-late thirteenth century BCE, .."
en.wikipedia.org
Well, "The Indus Valley Civilisation was a Bronze Age civilisation in the northwestern regions of South Asia, lasting from 3300 BCE to 1300 BCE, and in its mature form from 2600 BCE to 1900 BCE." -
Indus Valley Civilisation - Wikipedia
Do you think that Indus Valley civilization did not have any laws? There were societies much older to Indus valley. Think about the people of Gobekli Tepe (The settlement was inhabited from around 9500 BCE to at least 8000 BCE during the Pre-Pottery Neolithic -
Göbekli Tepe - Wikipedia). Moses that way, is very recent.
The Abarahamic laws are the codification of the laws by particular societies in their time. Believing that a God dictated them is falsehood. The Hindu advantage is that it is possible to change them to suit the times.