"The Gods of Magic have never asked to be worshipped, nor have they required the Orders to worship them. As the first Foundation states, a Wizard's first and only loyalty is to the magic. Even after the gift of divine magic disappeared, arcane magic remained. The three moons shone in the sky and the Orders continued with their practices: finding and training young people gifted with magic, giving the Test to those wanting to pursue High Sorcery, all the while isolating themselves within the Tower of Wayreth, protected by its grove, the Wayreth Forest." -
Towers of High Sorcery (affiliate link), pg. 76-77.
The theme of the gods disappearing at the end of Krynn's third age (the Age of Might), is that the gods didn't abandon mortals; mortals abandoned the gods, turning away from them in their pride and arrogance, as exemplified by the Kingpriest of Istar. It's why the constellations, planets, and moons didn't change, compared to the Fifth Age, when Takhisis stole the world, which resulted in the gods (who could no longer find it) not being represented in the heavens until the War of Souls, when they located Krynn again.
In other words, the arcane spellcasters kept their magic during the Age of Despair (i.e. the fourth age) because it was still there, the same way that Mishakal was still there for Goldmoon to find, etc.