The logical explanation for this would be that the Slave Trade served as a valve to get rid of surplus population, but also that it served as a way for the population to get capital from the outside. The end of the slave trade meant that the Ghanese export moved toward cash crops (losing land which could be used to grow food) instead, while at the same time losing a valve for surplus population.
This seems really unpleasantly Malthusian.
It's not, Malthusians is about population collapse because of population increase to much, and Ghana haven't seen that yet (and likely won't it ever). In fact in pre-industrial societies food insecurity are common, the only societies it wasn't seen was societies which was stayed underpopulated or frontier societies. We saw some similar on Iceland where outside the famines cause by vulcanic activity, the population was significant underpopulated thanks to a extreme high child mortality (cause by very poor postnatal hygiene) and regular population collapse thanks to epidemics (as it Iceland was virgin territories for most diesease because they burned themselves out) the population had a high degree of food security.
But a high degree of food security also mean that you don't adopt new crops or farming methods, as example the food insecurity of the 30 Year War in Germany meant that the potato was widely adopted.
In sub-Saharan Africa where the economy was widely built on the slave trade, there was little incentive to improve agriculture or governance, as the Europeans destroyed the slave trade, that also meant a collapse of the economical and political structure, making the later European conquest even easier. A exception to this was South Africa, who had less develop states nad had more proimitive technology than most of the rest of Africa, where the slave trade had little economical and political importance, and their economy was based on trade with the Dutch, this meant that the local tribes adopted foreign crops and improvement in political structures, which made the Zulu rise and expansion possible, and also push changes to warfare.