לזכות ר' משה גבריאל בן יהודית
ולזכות לאה אסתר בת פרימט
לברכה והצלחה בכל מעשי ידיהם!!
The Rosh in his commentary to the Torah, pointed out that the Torah uses the word וירא and Hashem "appeared" to Avraham in order to visit him in his illness after his bris, but doesn't say that Hashem SPOKE to Avraham. From here we see that one fulfills the mitzva even if the person is sleeping because when he awakens and hears that the person came it will make him feel better.
There are a number of issues to discuss.
A] What if the ill person wasn't in the room and he left a note? Apparently here he would also fulfill the mitzva because the ill person will feel good when he sees the note. Or maybe since he wasn't in the room at all it can't be considered that he "visited" him.
B] If there are two ill people, one sleeping and one awake, and you can visit only one - according to the Rosh it wouldn't matter and you can choose either of them. Or maybe the person who is awake is preferable because you are also causing him extra pleasure when he sees you.
C] If one is going to visit a sleeping person and a poor person asks for money, one would be exempt from giving him because עוסק במצוה פטור מן המצוה. But once one is sitting next to the ill person and a poor person comes he must be given because now he is not "busy" with the mitzva [because the person is sleeping] and just like one must give tzedaka to a poor person even though he is wearing tzitzis [since he is not "busy" with the mitzva], so too here.
Ad Kan Divrei HaRav Genechovski ztz"l.
We add: Rav Hutner points out that the word ביקור doesn't mean to "visit" but like the Torah says about animals בקורת תהיה - the must be EXAMINED. The true mitzva of ביקור חולים is fulfilled by examining what the ill person needs and fufilling those needs. So if he is sleeping it is definitely an inferior fulfillment of the mitzva. Even calling him up on the telephone lacks that essential component of being able to help him in some way. So if one can choose between an awake person or a sleeping person it would seem that the sleeping person is the preferred option.
Also, the poskim point out that in our times when one visits a person in the hospital the staff sees that people are paying attention, they are more likely to give better care. So that would make visiting a sleeping person worthwhile [and leaving a note would also accomplish that end].
The poskim also say that part of the mitzva is to DAVEN for the person afterward. When one SEES the person [better than talking on the phone] he is more likely to be aroused to tefillah. So as far as that is concerned a sleeping person is part of the mitzva too.
But it is definitely better if he is awake.