Turkey is set to free 38,000 prisoners being held in jails to make room for those accused of involvement in the recent failed coup.