Approximately two years ago, we have discussed the general parameters of the verse, “And you shall make a railing for your roof and you shall not place blood in your home.” This refers to building a gate or fence around the roof of one’s home so that one does not fall off of it. This is indeed a Torah commandment.
A Positive and Negative Commandment
One who does not build a railing around one’s roof transgresses a negative Torah commandment, besides for nullifying a positive Torah commandment, as the verse states, “And you shall not place blood in your home.”
Walking on a Roof that Does Not Have a Railing
The Poskim discuss whether or not it is permissible to go up to a roof that has no railing around it. We find no mention in the words of the Rishonim or Maran Ha’Shulchan Aruch about such a prohibition, as they only discuss the Mitzvah to affix such a railing. Indeed, Hagaon Harav Betzalel Stern zt”l discussed this in his Responsa Betzel Ha’Kessef and provides several sources that prove that there is no such prohibition as long as one takes great care walking around on the roof. The Yalkut Yosef (Sova Semachot, Volume 1) rules likewise.
The Torah only obligates one to install a railing on the roof of a “home,” i.e. a property that is used for continuous residential purposes, such as homes, buildings, hotels, and the like. However, properties used for storage and the like where people do not reside do not require railings around their roofs. Similarly, roofs of barns and the like do not require a railing around them.
The Torah only obligates one to install a railing around roofs that are used occasionally, such as if one stores things on the roof. However, slanted roofs do not require a railing around them since these roofs are not used at all and even when people climb up there infrequently, it is only to fix the tiles to prevent water from leaking into the house. This is indeed the prevalent Jewish custom all over the world.
The Rashba writes in one of his responses that the prevalent custom in Spain was not install railings around their roofs because they are not meant for use and people only go up there to fix it and plaster it. The Aruch Ha’Shulchan (quoted by the Yalkut Yosef) likewise writes that slanted roofs that are unfit for use do not require a railing.
Nevertheless, level roofs, especially when used for hanging clothing, storage, and the like, require a railing according to Halacha.