I'm so sorry to hear of your situation op. This appears to be in breach of the NHS constitution:
In March 2012 the NHS Constitution introduced a pledge that if admitted to hospital, patients will not have to share sleeping accommodation with members of the opposite sex, except where appropriate.
(where appropriate is in certain clinical specialised care situations but it sounds like if you and the other patient in the room are able to move around ie. not incapacitated, mix sex accommodation is certainly NOT appropriate).
Hospitals are supposed to take single sex accommodation very seriously, partly for reasons that you mention - making you share with a man could mean that you are excluded from hospital care in the same way that a woman with religious beliefs that prevents her from sharing would also be excluded.
It sounds like the nurses are being rather unsympathetic which is not ok - can you get your husband to make more of a fuss on your behalf - part of the difficulty is that it is hard to advocate for your own needs when you are feeling terrible.
Unfortunately, due to false advice on the law from the EHRC encouraged by Stonewall, many hospital policies do not seem to take single sex accommodation and the needs of women seriously. There are various court cases pending to try and address this.
I wish you a speedy recovery op. When you feel well enough it would be good if you could make a formal complaint to the hospital and contact your MP.
This is not acceptable from the hospital at all and they should be listening to you!
improvement.nhs.uk/documents/6005/Delivering_same_sex_accommodation_sep2019.pdf