At the time of Prophet Muhammad, Arabic was broken into various dialects, with a notable split between Western (Hijazi) and Eastern (Najdi) Arabic. Muhammad belonged to the Quraysh tribe in Mecca, whose dialect was Western.
The Islamic empire rapidly grew to include different Arabic dialects and non-Arabs after Muhammad's death. A linguistic unification of the Quran's text and pronunciation was needed. The third "Caliph" (religious leader), Uthman ibn Affan, developed a single definitive version based on the Quraysh dialect and rigorously destroyed all variants.
Subsequently, non-Arab scholars - who had less native intuition of the Quraysh dialect - codified Arabic grammar based on the Quran and pre-Quranic poetry. This included the system of lines and dots above and below letters to indicate the shape of short vowels.