With regards to abrogation (Ar.
naskh), it is a confirmed Islamic doctrine in the Qur'an. Since the Qur'an was revealed gradually over a period of twenty-three years, the legal rulings were not imposed on its adherents all at once. Rather, it gave them time to grow in faith and become accustomed to Islam. As Shaykh Abu Ammaar Yasir Qadhi mentions:
Among the blessings of Allaah to the Companions is that He revealed to them the laws of Islaam gradually, and thus made it easier for them to adopt these laws. Initially, there were no specific laws of halaal and haraam. The Companions during the Makkan stage were being trained spiritually so that they could form the nucleus of the future Muslim state in Madeenah. Once they had passed this stage, Allaah then completed the revelation of the sharee'ah in gradual steps, so that they could adapt to the lifestyle of Islaam.(Qadhi, An Introduction to the Sciences of the Qur'aan, Al-Hidaayah Publishing and Distribution 1999, p. 86)
And as Makkee ibn Abee Taalib (d. 1035CE) mentioned regarding abrogation:
And this (meaning naskh) is from Allah, and is meant to be for the betterment of His worshippers. So, He commands them with a ruling at a specific time, since He knows that it will be for their betterment for that particular time, but He already knows that this command will be removed from them at a later time, since at this later time that particular ruling will not be for their benefit. (An-Nahaas, p. 116.)
Thus, abrogation does not imply any imperfection whatsoever on the part of God, as critics allege. It does not mean that God made a mistake or that he didn't foresee an event. Rather, God knew in advance, and intended to send temporary laws for the early Muslims that would later be abrogated once the Muslim society became established.
It is analogous to a Professor who asks his students to perform 30 minutes of studying everyday for the first week. During the second week, he 'abrogates' his initial command and asks his students to perform 1 hour of studying every day. The Professor did not make a mistake initially, nor did he react to an unforeseen event. Rather, he had always planned to give a lighter load the first week to his students, and then increase the workload the next week because he knew they would be ready for it. In fact, he had his plan for the entire course written down and recorded. So when he initially gave the order to perform 30 minutes of homework, he knew that he would later abrogate this command.
Similarly, Allah initially gave some rulings that were later abrogated, but He
knew and
intended for them to be abrogated as the condition of the Muslims changed. He also recorded all His decrees in the Preserved Tablet; everythign was planned in advance. One may ask why some narrations seem to imply that God's revelation was a reaction to an event. The answer is that God revealed the laws at the occurence of such events so that the Muslims could appreciate the practical application of the law, and the need for such a law.