Fasting during the month of Ramadan is one of the five pillars of Islam, which is of paramount significance. The Prophet (peace and blessings be upon him) said, “Islam is built upon five pillars: testifying that there is no god except Allah and that Muhammad is the Messenger of Allah, performing Prayer, paying the zakah, making the pilgrimage to the Sacred House (Hajj), and fasting the month of Ramadan.” (Reported by Al-Bukhari and Muslim)
Sheikh Ahmad Kutty, a senior lecturer and Islamic scholar at the Islamic Institute of Toronto, Ontario, Canada, states: Allah says, (…eat and drink until the white thread of dawn appears from the black thread…) (Al-Baqarah 2: 187); accordingly, we must abstain from all food or drink from the beginning of dawn (fajr) until sundown. To do so, according to the consensus of scholars, is an essential condition for the validity of fast. Therefore, if you have deliberately taken the medicine after Adhan of fajr, then you have invalidated the fast, and you should make up for the same after Ramadan. If, however, you did so unknowingly, then your fast is still considered as valid. The Prophet (peace and blessings be upon him) said, “Allah has forgiven my Ummah of their sins borne of ignorance and forgetfulness as well as due to coercion.” (Reported by Ibn Majah and Al-Hakim)