The 33-year-old Brazilian, whose last match for the Reds came on the final day of the 2011/12 season in May, has not featured in any squad since.
Liverpool, who refused to comment on Doni's revelation, said it was for personal reasons but, after securing a deadline-day move back to his homeland to join Botafogo, the goalkeeper has explained the circumstances, which began while he was undergoing medical tests at the club.
"I almost... I almost ended up on the other side. I had a heart attack for about 25 seconds," the former Roma player told calciomercato.com in Italy.
"I've been to one of the best doctors in Europe who looked at me carefully. He's asked me to stop for a few months.
"Now I have to stay put until April, then I can return to the field, I want to play in the 2014 Paulista championship."
Doni also told Brazilian broadcaster Globo: "I always had an arrhythmia (irregular heartbeat) and during some tests in Liverpool suffered a cardiac arrest.
"I carried out checks across Europe and I had to extend my period of absence from the field."