The two-page decree - which was signed by Ghani and will be made public later by his office - said that all released Taliban prisoners will have to provide "a written guarantee to not return to the battlefield."
The decree lays out details about how the prisoners will be released in a systematic manner, a process that it says will begin in four days.
"The process of releasing 1,500 Taliban prisoners will be completed within 15 days, with 100 prisoners walking out of Afghan jails every day," according to the decree.
Talks between the Taliban and Afghan government to end the war will run parallel with the release, the decree said.
If the talks make progress, the government said it will release a further 500 Taliban prisoners every two weeks until a total of 5,000 Taliban prisoners have been freed.
The decree said that the Taliban will have to stick to its commitment to a reduction in violence during this period and beyond.
The release of the prisoners is part of a confidence-building measure to pave the way for the opening of direct talks between the government and the insurgents, after talks with both sides and the United States individually.
The issue has become one of the biggest sticking points in any progress towards peace, complicated by differing wording of documents between the United States and the Taliban, and the United States and the Afghan government.
"I urge the two sides to sit down immediately for talks on this issue in Doha, Qatar to work out the details," Zalmay Khalilzad, U.S. special envoy who was the key negotiator in the talks, said in a tweet.
"The Afghan government has agreed to do so. When implemented, this will be a significant step in the peace process," he said.
Commanders of the hardline Islamist group have sent vehicles to be ready to collect the fighters in a prisoner exchange and said they will honour the deal by handing over 1,000 government troops.
It was unclear whether prisoners would be released from other prisons aside from Bagram, a detention facility next to a U.S. military base.