Allāh ﷻ says in the Qur’ān:
“Verily, the number of months with Allāh is twelve months (in a year), so was it ordained by Allāh on the Day when He created the heavens and the earth; of them four are Sacred (i.e. The 1st, Muḥarram; the 7th, Rajab; the 11th, Dhū al-Qa’dāh; and the 12th, Dhū al-Ḥijjah). That is the right religion, so wrong not yourselves therein, and fight against the Mushrikūn collectively as they fight against you collectively. But know that Allāh is with those who are Al-Muttaqūn (the pious).”
[Sūrah at-Tawbah 9, verse 36]
In explanation of the above verse, Imām al-Qurṭubī al-Mālikī said:
“Allāh ﷻ mentioned the sacred four months in specific and forbade injustice in them as a kind of honor to them, although injustice is forbidden in all times. As for His ﷻ saying {so wrong not yourselves therein}, that means not to wrong yourselves therein by committing sins, because when Allāh ﷻ honors something from one aspect, it gains one sanctity; however, when He ﷻ honors it from two, or more, aspects, its sanctity becomes multiplex. Therefore, Allāh ﷻ multiplies punishment in it for doing evil deed as He ﷻ multiplies the reward in it for doing good deed. The person who obeys Allāh ﷻ in the sacred month in sacred city is not like the one who obeyed Him ﷻ in the lawful month in the sacred city. And the person who obeys Him ﷻ in the lawful month in the sacred city is not like the one who obeyed Him ﷻ in lawful month in lawful city.”
[Al-Jāmi’ Li-Ahkām Al-Qurān: 8/134]
‘Alī bin Abī Tālib – May Allāh be pleased with him – states that:
“A man came to the Messenger of Allāh ﷺ and said: “O Messenger of Allāh! Inform me of a month in which I could fast after the month of Ramadhān.” The Messenger of Allāh ﷺ said: “If you want to fast in any month after Ramaḍhān, fast in Muḥarram because it is the month of Allāh. It is a month in which Allāh ﷻ accepted the repentance of a nation and will accept the repentance of other nations [as well].”
[Aḥmad 1/154 and Tirmidhī 741]
Ibn Rajab al-Ḥanbalī says in Laṭāif al-Ma‘ārif:
“The Prophet ﷺ called Muharram ‘the month of Allāh’. Actually, attributing it to Allāh demonstrates its honour and merit, because Allāh ﷻ only attributes His special creations to His self. For example, He ﷻ attributed Muhammad, Ibrahim, Ishaq, Ya’qub and others among the prophets (upon them all be peace) to His worship, and as He ﷻ attributed His House (the Ka’bah) and She-camel to Himself.
Since this month is specifically attributed to Allāh ﷻ and fasting is one of the deeds which is attributed to Allāh ﷻ, it was considered appropriate to specify an action for this month – which is attributed to Him ﷻ – with an action – that is attributed to Him ﷻ and – done solely for Him ﷻ, viz. Fasting.
Fasting is a secret between a servant and His Lord. It is for this reason that Allāh ﷻ says: ‘Every deed of man is for him, except for fasting. It is for Me and I shall personally give the reward for it because he gave up his desires, food and drink for My sake.'” [Sahīh Bukhārī 1904]
Ibn Rajab further says:
Qatādah states that the dawn on which Allāh ﷻ took an oath in the first verse of Sūrah al-Fajr is the dawn of the 1st of Muḥarram from which the year commences. Since the [four] sanctified months are the most superior after the month of Ramadhān, or they are the most superior of all, it is desirable to fast in all of them – as instructed by the Messenger of Allāh ﷺ. One of them marks the end of the lunar year [Dhū al-Ḥijjah] while another marks the beginning of the lunar year [Muḥarram]. If a person fasts for the entire month of Dhū al-Ḥijjah – apart from the days on which fasting is prohibited – and then fasts for the entire month of Muḥarram, he would have concluded the year with obedience and commenced the next year with obedience. It would thus be hoped that his entire year will be recorded as an act of obedience. This is because when a person’s initial deed is an act of obedience, he is considered to be completely engrossed in obedience in the period between the two.
A Ḥadīth states: “When the angels, who are deputed to record deeds, take a book of deeds to Allāh ﷻ and He set sees good in its beginning and end, He ﷻ says to His angels: ‘I make you witnesses to the fact that I have forgiven My servant for the intervening period.'”