Colonial-era anti-gay laws
The push towards making African countries more tolerable to LGBT rights is essentially a struggle against punitive colonial-era laws in many African countries.
But with time, Africans have accepted these laws as their own and even tightened them. Conservative religiosity has been the strongest anti-LGBT force in these African countries.
Ironically, LGBT rights are now enshrined in the laws of the former colonial powers.