"Defence Minister Abdullah Habibi and Army Chief of Staff Qadam Shah Shahim stepped down with immediate effect," the presidential palace announced in a post on its Twitter account.
Shah Hussain Murtazawi, acting spokesman for Ghani, told Reuters the resignations were because of Friday's attack in the northern city of Mazar-i-Sharif.
At least 140 soldiers were killed and many wounded, an official in the city said on Saturday. Other officials said the toll was likely to be even higher. (Reporting by Josh Smith)