Sometimes a building has a flat roof. When it does, people may use the roof for a variety of purposes, from drying laundry to sunbathing. This is why it is important to erect a fence or a wall – we’ll use the word “parapet” – around the perimeter, to prevent accidents. (We must also do so around pits and other hazards.) The minimum height of a parapet is ten handbreadths, which is about three feet.
The reason for this is that, even though misfortunes that befall us down here are Divinely-decreed up above, you don’t want to invite such things being carried out with you as an unwitting partner. If someone’s time is up, he’ll expire when his time is up. Your job is to fortify your roof so that such accidents aren’t carried out through your negligence. (The idea that “God will protect me” is tantamount to relying on a miracle and the Talmud in Shabbos 32a tells us that one who relies on a miracle does not merit receiving one.)
This mitzvah applies in all times and places. It is discussed in the Talmud in the tractates of Baba Kama (51a), Chullin (136a) and elsewhere. It is codified in the Mishneh Torah in the eleventh chapter of Hilchos Rotzeiach. This mitzvah is #184 of the 248 positive mitzvos in the Rambam’s Sefer HaMitzvos and #75 of the 77 positive mitzvos that can be fulfilled today as listed in the Sefer HaMitzvos HaKatzar of the Chofetz Chaim.