He may have simply retired because he was old.
Throughout Half-Blood Prince he is described as coming out of "retirement". Specifically, when Harry and Dumbledore go to convince him to come back, he specifically mentions his age/weakness (my emphasis):
"Well, how have you been keeping, Horace?" Dumbledore asked.
"Not so well," said Slughorn at once. "Weak chest. Wheezy. Rheumatism too. Can’t move like I used to. Well, that’s to be expected. Old age. Fatigue."
"And yet you must have moved fairly quickly to prepare such a welcome for us at such short notice,' said Dumbledore. ‘You can’t have had more than three minutes' warning?"
Slughorn said, half-irritably, half-proudly, "Two. Didn’t hear my Intruder Charm go off, I was taking a bath. Still," he added sternly, seeming to pull himself back together again, "the fact remains that I’m an old man, Albus. A tired old man who’s earned the right to a quiet life and a few creature comforts."
And:
"What would the Death Eaters want with a poor broken-down old buffer like me?" demanded Slughorn.
We can easily figure out that Slughorn is no youngster. He was already teaching when Voldemort was in school, and we know from Chamber of Secrets that Voldemort is about 54 years older than Harry. So at the time of Half-Blood Prince Slughorn is likely well over 90 years old. It is thus, perfectly reasonable that he would have retired at some earlier point due to his age/declining health. In fact, he even insinuates that Dumbledore should think about retiring for that reason as well:
"You’re not yet as old as I am, Horace," said Dumbledore.
"Well, maybe you ought to think about retirement yourself," said Slughorn bluntly. His pale gooseberry eyes had found Dumbledore’s injured hand. ‘Reactions not what they were, I see."