Short answer
It is a sunnah with great reward, and one of the rights a Muslim has over another. The Hanafi school, like the other schools, counts it as sunnah for each person, while some scholars held it is a communal duty, so someone must visit. You may visit non-Muslims too, and men and women may visit each other with proper modesty.
Visiting the sick ('iyadah) is sunnah, more emphasised for relatives, neighbours and friends. It may be done for a non-Muslim, and a woman may visit a sick non-mahram man, or a man a sick woman, with hijab, without seclusion and where there is no fear of fitnah.
The four schools agree on this.
Explanation
The Prophet ﷺ listed visiting the sick among the five rights of a Muslim over another, alongside returning the greeting and following the funeral. He also said: feed the hungry, visit the sick and free the captive. In a hadith qudsi, Allah will say on the Day of Judgement, 'O son of Adam, I was sick and you did not visit Me', meaning that had you visited His servant, you would have found Him there.
Because the hadith call it a right, a few scholars held it is obligatory, and Imam al-Bukhari titled a chapter on its obligation. Most scholars, the Hanafis among them, say it is a sunnah for each person, and some describe it as a communal duty: if nobody visits a sick person who needs it, the community falls short. Either way, it should not be neglected.
- Non-Muslims. The Prophet ﷺ visited a sick Jewish boy who used to serve him. See visiting a sick non-Muslim.
- The opposite sex. A woman may visit a sick man, and a man a sick woman, with modest dress, other people present and a short visit. Aishah visited Bilal when he fell ill after the hijrah.
- Hospitals and infection. Follow the visiting rules, and do not visit if you are contagious. A call or video call can fulfil much of the purpose.
- How often. There is no fixed number. Visit as the patient and family find helpful.
What to say at the bedside, and the reward of the visit, are on dua for visiting the sick.
The evidence
Sahih al-Bukhari 1240
Sahih... حق المسلم على المسلم خمس رد السلام وعيادة المريض ...
"The rights of a Muslim over a Muslim are five: returning the greeting, visiting the sick..."
Visiting the sick is a right Muslims owe each other.
Sahih al-Bukhari 5649
Sahih... أطعموا الجائع وعودوا المريض وفكوا العاني ...
"Feed the hungry, visit the sick and free the captive."
A direct instruction to visit the sick.
Sahih Muslim 2569
Sahih... يا ابن آدم مرضت فلم تعدني ...
"O son of Adam, I was sick and you did not visit Me."
Allah's words show the great value of visiting the sick.
Where the ruling is recorded
- Umdat al-Qari (al-Ayni), Kitab al-Marda, chapter on the obligation of visiting the sick. A Hanafi discussion of whether visiting the sick is obligatory or sunnah.
- al-Fatawa al-Hindiyya, Kitab al-Karahiyya, chapter on dealings with non-Muslims. Permits visiting a sick non-Muslim.
Checked by our team. For a more accurate answer to your own situation, consult a scholar. Quran translation by Sahih International. Hadith Arabic from the standard editions of the six books and the Muwatta, with gradings as recorded there; the English is our own rendering. Spotted a mistake? Tell us.