Spokesperson Zabihullah Mujahid told Reuters in a voice message the fighters were in a "state of defence" during the Eid religious holiday.
Unlike some previous years, the Taliban have not officially declared a ceasefire for Eid this week.
Mujahid did not immediately reply when asked if the Taliban's defensive stance constituted a ceasefire.
Television images showed Ghani and dozens of others kneeling for prayer as the first explosion was heard. Most continued to pray as security guards could be seen in the background hurrying toward the sound of the blasts.
Insurgents have for years fired rockets into the city every now and then, usually inflicting only minor damage and few if any casualties.
In March last year, four rockets fell on the edge of the palace compound during Ghani's inauguration as president. Islamic State insurgents claimed responsibility.
Insecurity has been growing in Afghanistan in recent weeks, largely spurred by fighting in its provinces as US-led foreign troops complete their withdrawal and the Taliban launch major offensives, taking districts and border crossings.
On 15 Monday, diplomatic missions and the NATO representative in Kabul urged the Taliban to halt offensives, just hours after the insurgents and the Afghan government failed to agree on a ceasefire at talks in Doha.