Can he work at night and not fast by day because of taking medicine?
We ask Allah the Almighty, Lord of the Mighty Throne, to grant you a speedy recovery.
It is permissible for the one who is sick to not fast during the day in Ramadan, then when Allah heals him, he must make up the days when he did not fast, because Allah, may He be exalted, says (interpretation of the meaning):
“and whoever is ill or on a journey, the same number (of days which one did not observe Sawm (fasts) must be made up) from other days. Allah intends for you ease, and He does not want to make things difficult for you”
First of all you should try to look for work during the day that is compatible with your illness, as you have to take the medicine at night. By doing that you will combine both interests. If you cannot find any work except at night, and you are not able to take the medicine then because it makes you sleepy, there is nothing wrong with you working at night and taking the medicine during the day, and this will be an excuse for you not to fast.
If it is possible for you to leave the job, even if that is during the month of Ramadan, and then resume after Ramadan, that is better, so long as it will not result in negative consequences for you, such as being dismissed from your job. See the answer to question no. 65871
Al-‘Allaamah al-Haytami (may Allah have mercy on him) said: It is permissible not to do it (i.e., fasting) in the case of work such as harvesting or building for himself or for someone else, voluntarily or in return for payment, if it is not possible to work at night and if fasting could affect his ability to earn a living that he cannot do without. In that case, it appears that he may break the fast, but only as much as is necessary.
End quote from Tuhfat al-Muhtaaj, 3/430
In other words, it is permissible to break the fast for the one whose ability to earn al iving that he cannot do without will be affected. But his breaking of the fast should only be as much as is necessary. Based on that, there is no sin on you for breaking the fast if you are not able to leave your job, even if that is only for Ramadan.
If there is a hope of recovery from this sickness, then you have to make up the missed fasts when you are able to do so.
If the sickness will remain with you, according to the doctor’s opinions, then you do not have to make up the fasts, but you have to feed one poor person for each day you do not fast.
And Allah knows best.