An employer can terminate an employee while the employee is in the hospital under certain circumstances, primarily if the employee would have been terminated anyway, such as lay offs or performance issues that existed separate from the disabling condition.
An employer of more than 5 employees is required to provide an employee with reasonable accommodation of known disabling conditions as long as the accommodation does not constitute an undue hardship on the employer. One very common and appropriate way for an employer to accommodate an employee experiencing a temporarily disabling condition is to extend unpaid leave to allow the employee to recover from the disabling condition. Unless granting that leave would constitute an undue hardship, the employer is duty-bound to offer that leave to the employee, so long as the leave is not open-ended (with some exceptions) and for a reasonable time.
Thus, if the employee is hospitalized for a temporarily disabling condition, it would be unlawful for the employer to terminate that employee unless granting a reasonable unpaid leave would constitute an undue hardship.
Your second question is more difficult. If the employer was made aware of a disabling condition being suffered by the employee that would affect performance, and there was a way to accommodate the employee, such as temporarily reducing hours, or reducing job performance requirements, it is possible that terminating the employee for poor performance might constitute disability discrimination or a failure to reasonably accommodate. However, if the employee alerts the employer after the fact that the performance problems were due to a disabling condition, it is more problematic. Furthermore, the employer is usually not required to rely on the employee's word only regarding this. The prudent course is for the employee to get a doctor's note that contains certain work restrictions which is given to the employer. If those restrictions could be accommodated, then there may be ways to avoid a termination based on poor performance.
For instance, assume you are required to process 50 files in a day. If your doctor says that you need to slow down, or use a different motion to avoid some kind of disabling condition, and it is determined that there is a way for you to do your job with some kind of accommodation, such as reducing the number of hours you work in a day, or the availability of some different way to achieve the same results, or even perhaps a temporary reduction in the number of files you are required to process, and these fixes do not create an undue hardship on the employer, then the employer would be required to so accommodate.
Because the method of accommodation is an intensely factual analysis it does depend greatly on the kind of medical condition being suffered and whether there is a way to reasonably accommodate the condition given the kind of job that you have.
It would be prudent for you to consult with an employment attorney and share all of the facts with him or her. You can then get some solid advice about your rights.
Good luck to you.
This answer should not be construed to create any attorney-client relationship. Such a relationship can be formed only through the mutual execution of an attorney-client agreement. The answer given is based on the extremely limited facts provided and the proper course of action might change significantly with the introduction of other facts. All who read this answer should not rely on the answer to govern their conduct. Please seek the advice of competent counsel after disclosing all facts to that attorney. This answer is intended for California residents only. The answering party is only licensed to practice in the State of California.