It's supposedly all in the Qur'an.
At the heart of Islamic law lies the teachings of God and the acts and sayings of the Islamic prophet, Muhammad; therefore, sharia, Islamic law, is founded on the Qur'an and the Sunnah. However, sharia was not fully developed at the time of Muhammad's death, but rather it evolved around the Muslim community or Ummah through which it would serve.
When sharia began its formation in the deserts of Arabia about 1,400 years ago, the time Islam was born, a sense of community did not exist. Life in the desert was nomadic and tribal, thus the only factor that tied people together into various tribes was through common ancestry. However, the nature of Islam challenged that ideology and brought all those who professed their submission to Islam into the Ummah. Additionally, Islam was not just a religion but a way of life that transformed those who were once enemies into neighbors. Laws had to be instilled so the doctrines of sharia took root. All who are Muslim are judged by sharia – regardless of the location or the culture.
However, people do not change overnight nor do their habits of everyday life – sharia was indeed guided through its development by lifestyles of the tribes in which was initially absorbed into Islam. Thus, through the understandings of the tribe, Islamic law would be a law of the community – for the community by the community – even if initially proposed by an individual "for they could not form part of the tribal law unless and until they were generally accepted as such." Additionally, Noel James Coulson, Lecturer in Islamic law of the University of London, states that "to the tribe as a whole belonged the power to determine the standards by which its members should live. But here the tribe is conceived not merely as the group of its present representatives but as a historical entity embracing past, present, and future generations." So, while "each and every law must be rooted in either the Qur'an or the Sunnah," without contradiction, tribal life brought about a sense of participation. Such participation is further reinforced by Muhammad who stated, "My community will never agree in error" and thus, later recorded as a hadith.
After the death of Muhammad, sharia continued to undergo fundamental changes, beginning with the reigns of caliphs Abu Bakr (632–34) and Umar (634–44) in which many decision making matters were brought to the attention of Muhammad's closest comrades for consultation. In AD 662, during the reign of Muawiya b. Abu Sufyan ibn Harb, life ceased to be nomadic and undertook an urban transformation which in turn created matters not originally covered by Islamic law. Each and every gain, loss, and turn of Islamic society has played an active role in developing sharia which branches out into fiqh and Qanun respectively.