From “Visiting the Sick,” a tutorial by Ariel Scheib:
Visiting the sick bikur holim) is considered an act of loving kindness (gemilut hasadim). The concept of bikur holim is first introduced in the Bible when God visits Abraham while he is recovering from circumcision (Genesis 18:1). It is from this instant on that Jews are required to emulate God in visiting the sick. Jews are required to visit all who are ill, including gentiles. . . .
Rabbis believe that one who visits the sick takes away a sixtieth of his pain. However, a person is discouraged from visiting the sick where it would be a stress to the patient or cause embarrassment. It is understood that the visitor will enjoy many blessings and a happy life, filled with good friends and family. According to the Talmud, one should not visit the sick too early in the morning or too late at night and never stay too long because it may be too demanding for the patient. Furthermore, relatives and friends should immediately come to the side of the sick. The Talmud also states that the sick should not be informed of the death of a relative or friend, as it may cause them heartache and more pain.
Many Rabbis debate whether Jews are permitted to visit the sick on Shabbat, the day of rest and joy. While Beit Shammai prohibited such a practice, halakhah agrees with Beit Hillel that visiting the sick on Shabbat is an extra good deed.
Make known to me what is my end, O Lord, and what is the length of my days; that I might know how frail I am.
Lo, thou hast made my days but a span, and my life is as nothing; every man is but a breath.
Man passes away like a mere shadow; his worrying is all in vain; he gathers up and knows not who shall reap.
And now what do I wait for, O Lord? My trust is in thee.
From Psalm 38