The Torah (Devarim 22) states: “When you build a new house, you shall make a railing for your roof; and you shall not put blood in your home if one falls from it.”
This refers to the positive Torah commandment of building a railing around the roof of a house or a porch or balcony so that one does not fall from there and become injured or die.
The seemingly obvious question is: If Hashem decrees what will happen to every person, why did He command us to make a railing so that one does not fall? The Sefer Ha’Chinuch (the author of which is unknown but is certainly among the great Rishonim; the author explains possible reasons behind the Mitzvot of the Torah) writes: “Although Hashem is the one who decrees life or death upon an individual and one will not fall from a roof unless this has been decreed by Hashem in Heaven based on what our Sages tell us that ‘one does not bang his finger in this world unless this has been announced (decreed) in the Upper Realms,’ nevertheless, one must protect himself from occurrences which happen in this world, for Hashem has created this world and built it upon the foundations of nature. He has decreed that fire burns and that water extinguishes fire. Likewise, nature also calls for one’s head to be smashed if a large stone falls on it or that if one falls from a roof at a high elevation, this individual will die. Hashem has graced the physical bodies he created with a living soul which knows and understands how to protect the body from harm. After Hashem subjugated the body to the laws of nature, Hashem also commanded it to protect itself from naturally harmful occurrences, for the nature one’s body is bound by will carry out its laws on the body of man if one does not protect one’s self from being harmed by nature.”
The Sefer Ha’Chinuch means to tell us that although no good or harm can befall a person without it first being decreed in Heaven, nevertheless, Hashem established that the world run based on nature and if one does not protect one’s self from harmful occurrences, such as heat and cold, one will end up being harmed by them. Indeed, our Sages tell us (Ketubot 30a), “Everything is in the hands of Heaven besides for cold and heat,” meaning that all illnesses that befall a person are decreed so by Hashem alone besides for illnesses caused by heat and cold which one will contract alone if one does not protect himself from the elements properly.
The Sefer Ha’Chinuch continues: “There will, nevertheless, be some people who Hashem is especially fond of because of their piety and how they cleave to Him, such as the Patriarchs and many of their descendants after them including Daniel, Chananya, Mishael, and Azarya, whom Hashem placed control of nature in their hands, for instance, as we know, Avraham Avinu was thrown into a fiery furnace and emerged unscathed. Similarly, the four righteous men we have mentioned above threw themselves into a fiery furnace and emerged without a hair on their head being scorched. However, most people do not merit this lofty level as a result of their sins. It is for this reason that the Torah commands us to protect our abodes and areas so that death does not befall us as a result of our sins and so that we do not endanger ourselves on the basis of a miracle.”
It is for the above reason that the Torah commands us, first and foremost, for one to build a railing for one’s roof so that no one falls from there.