Primarily from a bacterial infection. Perhaps an uneaten piece of food that was in a dead spot in the tank, and the fish ate it, maybe even accidentally eating the feces of another fish? Those are jud guesses.
Hopefully this never happens again, but if it does and you catch symptoms before it goes, try having some maracyn and maracyn2 made by the brand 'Mardel'.
They treat different types of bacteria, but overlap in what they treat.