Do the laws of Yichud apply to a sick or old man?
Does not suffer from erectile dysfunction: If the sick or old man does not suffer from erectile dysfunction, then all the laws of Yichud apply, irrelevant of his age or illness. Accordingly, when this man has a caretaker of the opposite gender, care must be taken not to transgress the laws of Yichud during the visitations. Thus, either a Shomer [spouse/child] must be present or have Pesach Pasuach [open door or give keys to neighbors] to insure the laws of Yichud are not broken.
Sick or weak to point of erectile dysfunction: If the man has complete erectile dysfunction due to his very old age or due to his illness, some Poskim rule that Rabbinically forbidden forms of Yichud [i.e. girls below age 11] do not apply, however Biblically forbidden forms of Yichud [i.e. all girls above age 11] remain in state. Other Poskim however rule that all forms of Yichud are permitted with such a person, even Biblically forbidden forms of Yichud. Practically, if the patient is completely impotent due to his illness/weakness, in a time of need one may be lenient in all forms of Yichud. This especially applies if there is no expectations of recovery. If however the man can achieve erectile functionality, even if it is with difficulty, then Yichud laws would apply.
Unconscious/coma: If the male patient is in a state of coma or is unconscious, such as due to brain death, there is no Yichud prohibition at all in any case.
 See Dvar Halacha 2/9; Nitei Gavriel Yichud 5/3-5
 See Nitei Gavriel Yichud 5/3-5
 Zayis Ranan E.H. 1, brought in Dvar Halacha ibid; So also rules Rav SZ”A in Nishmas Avraham E.H. 22; See Sotah 26b that Issur Setira applies with a Shachuf; See Otzer Haposkim 20/11-5; See Nechpa Bakaesef 2/19 that “Lo Sikrav” related prohibitions don’t apply to a man with erectile dysfunction, however a Rabbinical prohibition certainly remains; See also Peri Hadama Issurei Biya 1 p. 41 and Tuv Taam Vadaas Telisa 1/5 regarding Chibuk and Nishuk
 See Kiryas Melech Rav 2/26 regarding Chibuk and Nishuk that possibly is even Rabbinically permitted, and certainly Yichud would be allowed; Dvar Halacha 2/9 that so is implied from Tosafus Sotah ibid; Meiri Sotah ibid; Maharshal; Iyun Yaakov; and so can be learned from Nechpa Bakesef ibid as hugging and kissing is more severe than Yichud, while Yichud would be permitted; Igros Moshe E.H. 4/65-10 that if he medically cannot have an erection due to his illness and weakness, there is no Issur Yichud at all, even of Biblical status, and even the Zayis Rannan ibid perhaps would agree to this, as perhaps he applies his prohibition only by an old person who can reach erection with difficulty; See Sanhedrin 22a that David Hamelech was allowed to in Yichud with Avishag [However this Yichud is only Rabbinical Yichud if she was Tahor, and is not a question on the Zayis Ranan]; Drashos Chasam Sofer 564 that Yosef was allowed to be in Yichud with Potifar’s wife because he saw that he did not have Gevuros Anashim;
 Nitei Gavriel ibid
 See Igros Moshe ibid that if he can achieve it through a long state of Hirhur then all Biblical Yichud applies as rules Zayis Ranan