Praise be to Allah, and may peace and blessings be upon the Messenger of Allah. To proceed:
This story has no known authentic basis in the books of the scholars of Islam, and it is not correct to rely upon it or attribute it to Moses, peace be upon him. The embellishment and strange rhyming contained in it further indicate its weakness. As for the issue of whether what has been decreed can change, it requires distinguishing between what Allah, Most High, has kept exclusively within His knowledge and writing, and what the angels write, which may change according to causes.
We have not found any authentic basis for this story in the books of the scholars of Islam.
Even if we were to assume that it has some transmitted basis in certain books, the manner in which it is formulated, together with its strangeness, artificiality, and deliberate rhyming—such as the expression “barren... Most Merciful”—while this wording does not resemble what is known from established narratives, all indicate that it is among the Isra'iliyyat (reports originating from the People of the Book) whose authenticity and original basis cannot be relied upon.
Therefore, it should not be circulated as an authentic story about Moses, peace be upon him, nor should matters of creed be built upon it.
This story raises an important issue: Can anything of what Allah, Most High, has decreed and written change?
It is established that Allah, Glorified and Exalted, knew what would happen to His creation and wrote their destinies before they occurred.
Allah says:
{And Allah created you from dust, then from a sperm-drop, then made you mates. No female conceives or gives birth except with His knowledge. And no one is granted a long life, nor is his life shortened, except that it is recorded in a Book. Indeed, that is easy for Allah.} [Fatir: 11].
And He says:
{No disaster strikes upon the earth or within yourselves except that it is in a Book before We bring it into being. Indeed, that is easy for Allah.} [Al-Hadid: 22].
Allah’s knowledge does not change, because He encompasses all things in knowledge.
Allah says:
{Your God is only Allah, besides whom there is no deity. He has encompassed all things in knowledge.} [Ta-Ha: 98].
And He says:
{So that you may know that Allah is over all things competent and that Allah has encompassed all things in knowledge.} [At-Talaq: 12].
Allah’s writing of the destinies of His creation is not of only one level.
The highest of them is the writing in the Preserved Tablet, and the scholars unanimously agreed that Allah, Most High, wrote in it what will exist.
Ibn al-Qattan, may Allah have mercy on him, said:
“They unanimously agreed that He, Most High, determined the actions, lifespans, and provisions of all creation before creating them, and recorded in the Preserved Tablet everything that would occur from them.”
Ibn al-Qayyim, may Allah have mercy on him, said:
“The Companions, the Followers, and all the people of Sunnah and Hadith unanimously agreed that everything that will exist until the Day of Resurrection is written in the Mother of the Book.”
There are also other writings made by the angels at different stages of a person's life, including what is written for the fetus.
The Prophet ﷺ said:
“The creation of each one of you is brought together in his mother’s womb for forty days, then he becomes a clot for a similar period, then he becomes a lump for a similar period. Then Allah sends an angel who is commanded with four words, and it is said to him: ‘Write his deeds, his provision, his lifespan, and whether he will be wretched or blessed.’ Then the soul is breathed into him...” Narrated by al-Bukhari (3208) and Muslim (2643).
There are texts indicating that some things in the writing of the angels may change according to causes.
The Prophet ﷺ said:
“Whoever would like his provision to be increased and his lifespan to be extended, let him maintain his ties of kinship.” Narrated by al-Bukhari (2067) and Muslim (2557).
It was also narrated from Salman, may Allah be pleased with him, that the Prophet ﷺ said:
“Nothing repels the decree except supplication.” Narrated by al-Tirmidhi (2139), who said: “This is a hasan gharib hadith.”
For this reason, scholars who have carefully investigated this matter have stated that the written decree includes a decisive decree that does not change, while another part is conditional upon causes, as found in the records shown by Allah to the angels.
An angel may write that something will occur in a particular way if no cause arises to change it. Then the cause upon which the matter was conditional occurs, and what is written in the records of the angels changes.
As for what is within Allah’s knowledge and what He wrote in the Mother of the Book and the Preserved Tablet, it does not change. Allah had known since eternity everything that would occur, including the cause that would lead to a change in what was written in the records of the angels.
Shaykh al-Islam Ibn Taymiyyah, may Allah have mercy on him, explained that provision is of two types:
One type is what Allah knows He will provide to the servant, and this does not change.
The second is what is written and made known to the angels. This may increase or decrease according to causes, including maintaining family ties.
He gave as an example the hadith of the Prophet ﷺ:
“Whoever would like his provision to be increased and his lifespan to be extended, let him maintain his ties of kinship.”
He, may Allah have mercy on him, explained that an increase or decrease that occurs in the record held by the angels does not mean that Allah’s knowledge has changed. Allah knows a thing before it exists, and He knows what He will write for the servant and what He will increase for him because of the causes he undertakes.
This is also included in the saying of Allah:
{For every term there is a record. Allah eliminates what He wills and confirms what He wills, and with Him is the Mother of the Book.} [Ar-Ra‘d: 38–39].
The Mother of the Book with Allah, Most High, does not change. As for what is in the records of the angels, erasure and confirmation occur in them according to the causes Allah wills.
The story of Moses, peace be upon him, with the barren woman has no established basis, so it is not correct to circulate it as an authentic story.
As for changes in some decrees, this does not mean that Allah’s knowledge changes or that what is in the Preserved Tablet is altered. Rather, Allah, Glorified and Exalted, knew everything and wrote the destinies of His creation according to what would occur in His prior knowledge.
As for what is written by the angels, it may be conditional upon causes, and it may therefore be erased or confirmed according to those causes, such as supplication and maintaining family ties. All of this is already known to Allah.
Thus, supplication itself is a cause that Allah has decreed, and what results from it—such as an answered supplication, the repelling of harm, or the attainment of good—is part of Allah’s decree and prior knowledge. This does not require any change in Allah’s knowledge or the occurrence of something that was previously unknown to Him.
And Allah knows best.