Thanks for your patience. It is possible and legal to dismiss someone whilst they are off sick and being off does not in itself give you any immunity against that. However, the employer should not rush towards the disciplinary and they should give you some time to recover and try to attend. This will depend on how long you are off for but the longer you are off then the more likely it is that they will eventually proceed with the disciplinary anyway. If they do, they must still ensure that it is done fairly, so for example they could do it over the phone or give you the opportunity to provide a full defence in writing.
If you wanted to leave them anyway then you can potentially consider resigning and remaining on sick leave for the rest of the notice period. There is no guarantee that they won't proceed with a disciplinary still, but hopefully they will just let you go, knowing that you will be leaving anyway.
Another alternative is to approach them now and see if they are willing to let you go and drop the disciplinary in return, so you both go tour own separate ways. You can try and negotiate at least a basic reference as part of that too but it is of course down to them.
So there is no right or wrong way to go about this to be honest and it all depends on the employer and what their intentions are and how far they are willing to take this. They may just want you out but without caring to much as to how that happens and they may be happy with you resigning, giving them an easy way to get rid of you. So you can approach them to discuss that and see if they are willing to just let you go, potentially with a reference.
I trust this has answered your query. Please take a second to leave a positive rating by selecting 3, 4 or 5 stars above - this is an important part of our process and recognises the time I have spent assisting you. If you still need me to clarify anything else, please reply on here and I will assist as best as I can. Thank you