It goes without saying that Islam warns against rigidity in religion. Prophet Muhammad (peace and blessings be upon him) is reported to have said, “Woe to those who practice rigidity; woe to those who practice rigidity; woe to those who practice rigidity” (Muslim).
It is absolutely permissible to brush one’s teeth using toothpaste while fasting provided that one is cautious not to let the toothpaste reach the stomach.
In his contribution to this issue, Sheikh Ahmad Kutty, stated,
Fasting is one of the most fundamental pillars of religion. As such, we believe that Prophet Muhammad (peace and blessings be upon him) has communicated its essential rules plainly and clearly. He also warned us against rigidity in applying the rules of religion, which he always insisted, were based on ease and simplicity.
It is essential for us to know that the Sharia such matters should be used in reference to common usage and understanding among humans; it goes without saying — as some of the great imams have pointed out — that humans, since time immemorial, have never considered activities such as brushing teeth (with paste or without paste) consuming foods or drinks.
These are not the ways humans have been feeding themselves from time immemorial. Therefore, to go to such excessive lengths in interpolating such rigid rules is at once contrary to the general spirit as well as the stated intents and purpose of fasting. Fasting, as clearly stated in the Qur’an, is intended to nurture mindfulness of Allah and self-restraint, thereby deepening and enhancing our spiritual awareness.
Therefore, we are better advised to leave the matter as Almighty Allah has left it as simple and easy to follow, and thus focus on the inner dimensions of fasting. Otherwise, we will end up reducing Islamic acts of worship into absurd and meaningless rituals, devoid of any higher purpose or objective.