In reality, there are two versions of the sharia: the Uncreated Sharia, which is known only to
Allah, and the Created Sharia, which is known to human beings. Traditionally, there were three sources of revelation whereby the Uncreated Sharia was revealed and turned into Created Sharia. These were the
Qur'an, the
Hadith, and the
Sunna. In other words, the actual text of
Islam's sacred text (note that this is the Created
Qur'an, which exists on
Earth, as opposed to Uncreated Qur'an, which is, like Uncreated Sharia, known only to
God), the collected sayings and anecdotes of the Prophet, and the customs of those who had gone before (sunna has a meaning close to 'custom' or 'tradition', from which we get
Sunni, the most populous branch of Islam).
In practice, the sunna becomes similar to the concept of precedent in the civil and criminal law of various nations of the world, as well as the idea of legal interpretation. Learned scholars of the sharia and Islam generally, the ulama, would render opinions on aspects of religious law, based on the rulings of earlier scholars and their own interpretation of the law.
The goal of all of this is to make created Sharia as close as possible to the Uncreated Sharia. This is, in the end, impossible, since Allah is held to be perfect, while humans are flawed. Therefore, while the Uncreated Sharia is perfect and infallible, and therefore cannot be changed, the Created Sharia is subject to reform, re-interpretation and change, and is therefore not infallible.