If you need to resign from your current position on medical grounds then I am sure you will have had many discussions with your employers over the past weeks/months and they will be aware of some of the problems that you have been having.
If this is the case it will make it much easier for your employers to understand and depending on what the medical grounds are, you may be unable to fulfill your notice period. It may be worth having your sick notes or any documentation that you have from doctors or hospitals that you can show to your employers. At some point to terminate your role, they will need to see this evidence.
If you are ready to write your resignation letter, please see the below example which you can use as a guide.
Letter of Resignation Due to Medical Reasons
Mr. A. Employee
1, My House
Mrs. A. Manager
Resignation from POSITION due to medical grounds
I am very sorry to be writing this letter to hand my resignation in due to medical reasons. As you are aware I have been having some medical problems over the past few months and it has left me now unable to continue working.
I am very sorry that it has to come to this and I enjoy working for COMPANY NAME and have enjoyed my career to date. Unfortunately I now need to face facts and pay more attention to my health and I am unable to do this whilst I am still working. I do hope that you understand the predicament that I am in.
I will do what I can to help you with a swift hand over for my role but would like to finish as soon as I am able to so I can concentrate on my recovery/time remaining etc.
Thank you again for giving me this opportunity and experiences, I have thoroughly enjoyed my time with COMPANY NAME.
Best wishes for the future.