Sheikh `Atiyya Saqr, former head of Al-Azhar Fatwa Committee, states: “Anas (may Allah be pleased with him) is reported to have said: ‘On entering the bathroom, the Prophet (peace and blessings be upon him) used to take off his ring.’ It is well-known that the Prophet’s ring was having the words ‘Muhammad is the Messenger of Allah’ engraved on it. The simple reason for this is that the bathroom is a place not suitable for the Name of Allah to be taken into. Thus, one is not allowed to enter the bathroom while wearing a ring or anything else that contains Allah’s Name.
As for entering the bathroom with an object on which a verse from the Qur’an is written, the Shafi`i and the Hanafi scholars say it is reprehensible while the Maliki and the Hanbali scholars hold it as haram.
But we have to emphasize here that the ruling as regards entering bathroom with ring bearing Allah’s name applies to normal cases in which there is no fear of the loss of the ring. In case it may be lost, then it is allowable to take it into the bathroom.”