President Ghani was talking to the graduation ceremony of Afghan National Army on Wednesday and said that there are a lot of problems in front of the unity of Afghans.
He also praised the efforts being made by national security forces for freeing the 31 civilians.
The abduction of 31 Hazaras took place about three weeks before but their fate is still unknown.
They were kidnapped by masked gunmen on Kabul-Kandahar highway in the jurisdiction of Zabul province.
Local elders tried to mediate the release but their efforts also did not give a positive result.
Residents of Zabul province have said that the 31 civilians are kidnapped by Islamic State fighters.
The abduction of the 31 Hazaras prompted demonstrations in various parts of the country including capital Kabul.
After the abduction in Zabul province, two other cases of the abduction of Hazaras took place in Ghazni and Herat provinces.
The responsibility of the kidnapping is not claimed by any group but the situation has raised fresh concerns over the presence of Islamic State or DAESH in the country.