A mezuzah is a miniature Torah scroll containing the first two paragraphs of Shema Yisrael and thus is not muktzeh.[1] However, this particular scroll should be treated as muktzeh since its case was affixed to the doorpost in a manner that would require dismantling (forbidden on Shabbat and Yom Tov).[2] This is because the word “muktzeh” means “set aside from use,” and this mezuzah was inaccessible when Shabbat came in.
Nevertheless, since a holy scroll is lying in disgrace on the ground, the authorities agree that one may pick it up. Preferably one should pick in up in an unusual manner in deference to those who maintain that it should still be treated as muktzeh.[3]
Once the mezuzah enters one’s hand, he may walk with it until he finds a safe place to deposit it. Logically, one would then proceed to slip it into the case that it fell from, with a berachah, in order to resume the mitzvah. Many authorities hold that merely slipping the scroll back into its case is not problematic even though on Shabbat and Yom Tov one is not allowed to “build or construct.”[4] Snapping a case onto the doorpost or onto the part of the case still affixed to the doorpost would not be allowed.
If putting up the mezuzah involves a possible Shabbat violation, one would be exempt from the mitzvah due to circumstances beyond his control. Because of this exemption one would not be required to leave the room, as this would entail effort.[5] Certainly, there is no requirement to leave your house. When there is little effort necessary, some suggest that one should move to another room.[6]
[1] Shalmei Yehudah 1:12, citing R’ Eliashiv; Shevet Yehudah 4:143; Agur B’Ohalecha 41:5. Cf. Minchas Shabbos 88:122.
[2] Beiur Halachah and Mishnah Berurah 518:45
[3] Agur B’Ohalecha 41:2
[4] Shevet HaLevi 4:143; Agur B’Ohalecha 41:2; cf. Mezuzot Beitecha 186:22.
[5] Magen Avraham 19:1
[6] Pitchei Teshuvah and Aruch HaShulchan Y.D. 285:1.