Many people wonder how the Quran was written down and compiled, since, of course, at a certain point there was a decision made to write the Quran.
The Prophet Muhammad, peace be upon him, wasn't schooled in reading or writing, according to Muslim tradition. The Quran refers to this in the 29th chapter stating, “You never wrote one down with your hand. If you had done so, those who follow falsehood might have had cause to doubt”.
The fact that the Prophet Muhammad, peace be upon him, was not schooled in writing and had to have other people write for him is a further reassurance to Muslims that he wasn't making it up.
He was getting it as a revelation from God, because if he were making it up, how could it come out with all of the beauty and elegance of a written text that the Quran turns out to have? He called in his companions to write it down according to Muslim tradition. There was a wide variety of simple materials, even mentioning the barks of trees, a flat stone, and so on. It would be sometime after the death of the Prophet Muhammad, peace be upon him, that all of these diverse written pieces were collected and rewritten into the text of the Quran as we have it now.
In regards to who exactly wrote the messages of the Prophet, peace be upon him, there were only a few people mentioned in Islamic tradition who were able to read and write. Along the lines of thinking that they were only a few literate people, we learned that after a certain battle, when the spoils were taken account of, naturally the Muslims lost some lives in that battle. The Muslims also happened to have captured some of the non-Muslims who had come to fight against them. The question arose of what to do about these new captives because they didn't have a checklist outlining what to do with the prisoners of war. This was a new experience for them. It was then thought that if someone could teach the Muslim children to read and write, then that person would be set free after this community service. While that was taken on, it was found that only a few people could satisfy this requirement. People generally were not so literate at that time.
Some companions are well-known for being the scribe of the Prophet, peace be upon him. Zayd bin Thabit was one of those who was a clever young man. He was even able to learn other languages as well so that he could help the Prophet Muhammad, peace be upon him, with some foreign correspondents. He was commissioned after the death of the Prophet Muhammad, peace be upon him, by Abubakar, according to Muslim tradition to make the first semi-official compilation of the Quran. He went around to everyone who had some written pieces of the Quran and transcribed those written pieces onto sheets so that they were collected into a stack of sheets. These sheets were then left in the heir of Abubakar, the first caliph, after the Prophet Muhammad, peace be upon him, had passed away. This was done within two years of Prophet Muhammad’s death because Abubakar's caliphate only lasted for two years.
Due to the various battles taking place at this time, there was a fear that all the people who had memorized the Quran might have passed away and that the Quran would be lost.
In fact, according to the story, this is what prompted Abubakar to have Zayd bin Thabit make this collection. At first, there was some resistance to the idea. The thought was since the Prophet Muhammad, peace be upon him, hadn't done this, we would be overstepping our reasonable limits by doing something that he didn't do. Yet, they saw this as a necessity because the people who were at the forefront of trying to defend the frontiers of Islam were the people who were also very much infused about the text of the Quran and the revelation that came to the Prophet Muhammad, peace be upon him. These were the people who were willing to give their lives for the message. They were willing to give their lives not only on the battlefield but also in their spare time, in that they devoted themselves to memorizing the texts. These texts were dear to them. When it so happened that the people who memorized the Quran were the same ones who went out to defend the Muslim frontiers, they were killed in battle. The leaders saw that we could not continue like this because a large number of the memorizers of the Quran were said to have been killed in battle. This was very alarming and the leaders thought that we need to preserve it in writing as well. This was to ensure that with this double method, people memorizing and also having the Quran in writing, it would not be lost to subsequent generations.
Since it is said that the Quran was memorized first and then put into writing, a concern may arise that the Quran we have today may not be the same one that was revealed to the Prophet Muhammad, peace be upon him. A large number of manuscripts have been discovered recently and many of them have been published by an institute in Turkey that goes by the acronym IRCICA. They have published and are selling these manuscripts. They have published them in handsome volumes as keepsakes, proudly to demonstrate to Muslims that the Quran as we have it in all of these ancient texts is essentially the same book. You might find some variations in the spelling, for instance, somebody spells a word with a long A, someone spells it with a short A, but it's still recitable with a long A. They show that you may have some spelling variations and you might even have a mistake in the text, but sometimes someone tries to correct it either in the margin or by writing something above or below. This is because they're all handwritten as opposed to being printed text in which you can churn out a million copies, all looking exactly the same. Yet, with handwritten texts, people get tired, they miss a line, they write a line twice, and so on. Basically, we have the same texts. The variations in these texts are not so great as to affect anything that Muslims believe in or to affect Muslim practice in any significant way.
The most significant variations we find is in a text that is referred to as the Sanaa Palimpsest. “Palimpsest” among manuscript specialists refers to a document that has been erased and then the writing material is used to write something else, sometimes the same text, but sometimes a different text. It so happens that the erased writing on that palimpsest was Quranic text. The text written over it is also a Quranic text. What is written over it corresponds more closely to what we are reading today in our Qurans with the same conclusion that the variations are not so great as to affect Muslim belief or Muslim practice in any significant way. The lower texts which had been erased are now visible with ultraviolet light and modern techniques that recover scraped off text. The texts are shown to also be Quranic and it is not clear if that meant to be an actual, accurate text of the Quran or not because there were more variations in that text. However, as mentioned earlier, their two variations are not so great as to affect anything that Muslims believe or to affect Muslim practice in any significant way. The variations which are noted are the types of variations from Muslim history as attributed to great reciters of the Quran like Ibn Masud, Ubayy ibn Kab, and close companions of the Prophet Muhammad, peace be upon him. Muslims have a way of putting this all together by saying that the Prophet Muhammad, peace be upon him, may have authorized some of his companions to read the same text in a variety of ways. Perhaps this was to make it easier for people to memorize so that they were not given the structure that it must be like precisely these letters and these words - so long as the meaning was maintained and the guidance was available through the recitation.