When you get asked about this, your interviewer is going to be looking for a few things:
- are you honest about what happened self-reflective about the causes, and take ownership of the parts that were under your control?
- what have you learned from the experience that might help prevent something similar from happening again?
Definitely don't shy away from it, or claim that you quit. Getting fired isn't a dealbreaker, but dishonesty is.
So, if someone asks you "why you'd leave Company X?" (which, if they're a good interviewer, they will), you'll want to be able to say something like:
"Actually, I was fired. I had some medical issues that I let get out of control, and my work suffered. I've got the medical stuff sorted now, and I've learned how to take better care so that my work should stay consistent in the future."
I obviously don't know the specifics of your situation, so that's fairly vague; it's better if you can share specific work strategies that you've since learned, i.e. around managing your priorities/task lists or whatever. You don't need to -- and shouldn't -- go into specifics about the medical side, but you certainly can talk about things you've learned to keep yourself engaged and focused at work.
Good luck!