I'm not sure why you left without answering my questions. I asked them because they are legally significant. They are the same questions I'd have to ask you in person in order to fully answer your questions.
I'll have to try and answer your question, vaguely, without the additional information.
It is not illegal to terminate someone while they are under the care of a physician. Not automatically. A good example here would be if you were under the care of a physician and called your boss, and cussed him/her out while under the care of a physician. The fact that you were under medical care wouldn't save your job.
So, what matters is what the basis for the termination actually is. Here, it is absences. Now, medical absences covered by the Family Medical Leave Act can't be counted as absences against you. If you were suffering from a serious health condition and those absences that you had related to that serious health condition, none of those medical absences (up to 12 weeks in one year) can count against you.
However, if you were eligible for termination even if they didn't count the FMLA days as absences, then you can still be terminated.
As you can see, these issues are very fact dependent. You aren't automatically protected just because you were under medical care. We have to understand exactly how many absences were attributable to that care and whether or not you were terminated based on absences that should have been covered by the FMLA....which is why I asked my questions.
Now, I recognize my answer is very generalized but that is because I lack the information that I requested. If, after reading this answer, you have additional questions, please use REPLY and ask them.