Naskh (نسخ) is an Arabic word usually translated as “abrogation”. Abrogation in Islam recognizes that one rule might not always be suitable for every situation. Far from Allah changing his mind, abrogation demonstrates the wisdom of Allah in legislating rules for their appropriate time and context who has perfect knowledge there is no reason that he changes his mind. Allah has mentioned in the Quran as follows:
And the word of your Lord has been fulfilled in truth and in justice. None can alter His words, and He is the Hearing, the Knowing. (6:115).
When Prophet pbuh and his companion migrated to Madina and the Islamic society was going to establish in the Madina. Where the people were accepting Islam in large number unaware of the law and prohibition.
The Quran was revealed in stages over a period of 23 years, and not as a complete book in one single act of revelation. So that Allah made it easy to understand, interiorize and apply the Revelation easily. The revelations that are abrogated are those revelations that were revealed before the Qur’an, for example the Torah (revealed to Moses pbuh), the Zaboor (revealed to David pbuh) and the Injeel (revealed to Jesus pbuh).It’s very difficult to change theestablished society’s structure mindset, culture, values, history and law at once e.g Gradual prohibition of intoxicants, Inheritance law, Adoption rule, Fasting, Direction of kaba, Permission to enter the houseetc.. when people learnt the law and its application then through historic event came to know that they spilled the pot of alcohol and drained the liquid. Same with direction of kaba Allah wanted to test them. So its blessings so that we can get acquainted with it.
When We substitute a verse in place of a verse, and Allah is most knowing of what He sends down, they say: You are but a forger! But most of them do not know (Surat al-Nahl 16:101)
Abrogation doesn’t implies that Allah can change his mind. Everything that happened, happens, and will happen, is according to His Perfect Knowledge and Wisdom. Abrogation doesn’t implies some verses are wrong or obsolete, and are thus superseded. Also, it doesn’t mean that verses contradict each other.Quran is complete, perfect, and it isn’t pliable according to desires of anybody.