The Qur’an is the final message Allah has sent to mankind. It was revealed to the Prophet Muhammad (peace be upon him) through the Archangel Gabriel, who brought the Prophet complete verses or parts of verses, or passages or complete surahs, as he was commanded by Allah. When the angel brought down to the Prophet Muhammad (peace be upon him) a passage of the Qur’an, he did not bring it written on a piece of paper [or other material]. He recited it to him and the Prophet immediately memorized it. In his keenness to learn it by heart straight-away, the Prophet used to vocalize the words as he heard them from the angel. He was then asked by Allah not to do so. Allah promised him that He Himself will see to it that the Qur’an is kept complete and intact and properly read. This order is contained in Quran: “We have, without doubt, sent down the Message; and We will assuredly Guard it (from corruption).” [Al- Hijr 15:9]
Shortly after the Prophet’s death, the community chose Abu Bakr as their temporal chief, the Khalifah of the Messenger, the Caliph. About a year later, a large number of those known as authoritative memorizers were killed in a battle. According to authentic Hadith literature, `Umar Ibn al Khattab (who became the second Caliph) was alarmed by this and concerned that the next generation may not have enough teachers of the Qur’an. He, therefore, approached Abu Bakr, and suggested that a formal compilation of the Qur’an be prepared on materials that would be convenient to store, maintained, and used as a reference. According to the Hadith literature, Abu Bakr was reluctant to do something the Prophet himself had not undertaken. After a few days, however, he “became inclined” to the idea and asked Zayd to undertake the task. Zayd says he also hesitated but, after contemplation, also “became inclined” and agreed to undertake the work. A committee was formed to do the job. They compiled a collection by checking and double checking each Ayah of the existing record of the Qur’an with the memories of each member of the committee as well as of the other prominent experts. This copy was housed with the Prophet’s wife Hafsa. (She was a daughter of `Umar ibn al Khattab).
As you are well aware, the Prophet Muhammad (peace be upon him) did not read or write. When he received a portion of the Qur’an, he called in one or more of his scribes to write it down. He employed for this task a number of his companions whose number totaled 29. Many of these were of the highest caliber in their faith and integrity. They included all the first five caliphs- Abu Bakr, Umar, Usman, Ali and Muawiah. However, the task of writing the revelations was most particularly associated with two of them, Muawiah and Zaid ibn Thabit, despite the fact that Muawiah was a latecomer to Islam. Paper, as we know, was not yet invented. Those scribes wrote the Qur’an on various forms of writing material which was available to them. The main aim of the Quran is to learn by heart, but to assist in learning it, people would write it down as it was being revealed to the Prophet (pbuh). It was written on wood, leather etc. by different people. However, 19 years after the Prophet (pbuh) passed away, the Khalifah Uthman(ra) realized that there were too many of these pieces that were floating around and could cause corruption or loss of text. Hence, he gathered all those small pieces together and burnt them. The Muslims formed a committee and compiled a standard version. This was in the presence of Uthaman(ra), Ali(ra) and many other people who were present always beside the Prophet(pbuh) when the Quran was revealed or had learnt the entire Quran by heart under the Prophet(pbuh). This was easily compiled as all of them knew the Quran entirely by heart.
Some of you might ask, “Why was the Quran not compiled at the time of the Prophet?”
Well this is solely because:
The revelation of Quran took 23 years and it had continued to the last year of the Prophet Muhammad’s (PBUH) life. So nobody was able to compile it as a book during the Prophet’s life, since it was not complete.
But after the Prophet’s demise everyone knew that the revelation had finished and the Quran was not going to change anymore (no ayah would be added). So at that time they collected all those scripts written by sahaba and compiled it.
Thus was the Quran compiled for use generations later.