When a villager is sick, the villager will be walking around inside his or her house with black spirals appearing above his or her head, occasionally stopping to shiver. The villager will seem disoriented when you talk to him or her. The villager will also usually walk diagonally while sick, rather than walking in horizontal and vertical lines. This means that your villager is sick! You can ask the villager if he or she is OK, and you can also ask if the villager needs medicine.
How to help the villager get well again
You can purchase medicine in Tom Nook's store. If you have medicine in your pocket, you can choose the "need medicine" option when you talk to the villager. The villager will gratefully take the medicine, and will say something about feeling better.
You can only give a villager one dose of medicine per day. You do not get the "need medicine" option when talking to the villager after you have given the villager a dose of medicine for the day.
How long will it take for the villager to get well?
The villager will not recover right away. You will need to check in on the villager the next day to find out if he or she has gotten better. If not, give the villager another dose of medicine, and keep doing so for as many days as it takes for the villager to recover.
What if I do not give the villager medicine?
A villager will recover from sickness on his or her own after a while, although it takes longer than it would if you gave the villager a daily dose of medicine. Villagers cannot die of sickness or any other cause. The villager will not go outside for as long as he or she is sick, however, which makes it a little harder to build friendship with that villager.
Will a villager change his or her hobby after recovering from getting sick?
No; if a villager has a current hobby (such as collecting clothes, gardening, collecting furntiure, and so on) but gets sick, the villager's hobby will be the same after he or she recovers from getting sick.
What makes a villager get sick
As far as I know, a villager getting sick is just completely random. It is not related to walking around in the rain or falling into pitfalls or anything like that.
The gate trick
You might have heard that you can cure a villager instantly by just opening and closing your gate. This is true: open your gate for a while, and after you close it, the sick villager will have recovered from the sickness. However, I do not endorse this method, because I consider it to be a cheat, which ultimately takes fun away from the game.