The Qur’an was first compiled during the lifetime of Abu Bakr As-Siddiq (رضي الله عنه), the first khalifa, whose rule lasted from the death of the last messenger (صلى الله عليه و سلم) for two years.
Why wasn’t it compiled during the time of the Prophet (صلى الله عليه و سلم) himself?
- On-Going Revelation: Revelation was still coming down. If you wrote two verses next to each other, and Allah revealed one in the middle–or an extension to the end of a surah–what then? They didn’t have staplers to staple pages into the middle!
- No Need: The Messenger of Allah (صلى الله عليه و سلم) was still alive, and so were his companions, and they were all there with him. What need was there to compile it? The knowledge was there in the community.
- Arrangement was not Finalized: New verses would come down and be added to the middle of surahs. If it’s already written in a book, what do you do? How can you fit it in?
- Abrogation: Although abrogated verses are very few, sometimes a verse would be abrogated–so what if it was written down? What do you do with it?
In any case, in Abu Bakr’s time, there was a big battle, where 70 huffadh were martyred. After this one battle, ‘Umar convinced Abu Bakr–who was hesitant at first–to compile the Qur’an into one book. Prior to this, it was written down in scraps and fragments; and some of it was only memorized, not written down. And ‘Umar feared that the unwritten parts would be lost.