Sharia was implemented to create one legal code. There were various different ruling dynasties. Each was enforcing the code differently. Scholars gathered to debate whether one of those was actually enforcing it properly. By coming together, they could codify and set down one set of laws. There would not be multiple ways to interpret and handle the laws or their violation.