President Ashraf Ghani said the assault near the northern city of Mazar-e-Sharif had been contrary to all human values and Islamic teachings.
Insurgents targeted those leaving Friday prayers at the base's mosque and others in a canteen, the army said.
Some of the survivors suggested the attackers had had inside help.
One of the injured soldiers said: "When an attacker enters the base, why was he not challenged? There is not just one barrier or security gate, there are seven or eight."