Hazal instituted a Beracha to be recited when seeing the site of a great miracle, such as if one could visit the spot on the beach where the sea split for Beneh Yisrael, the rock upon which Moshe sat during the battle against Amalek, or the stones which G-d cast upon the Canaanites during the battles waged in the time of Yehoshua. Additionally, and more practically, Hazal instituted a Beracha that one must recite when he visits a place where he experienced a personal miracle. The text of this Beracha is, "Baruch Ata Hashem Elokenu Melech Ha’olam She’asa Li Nes Ba’makom Ha’zeh" ("Blessed are You, O G-d, G-d of our forefathers, King of the world, who performed a miracle for me at this place").
Once recites this Beracha no more than once every 30 days – not including the previous or current time that he visits the site of the miracle. If one visits the site more frequently, then he does not recite the Beracha. The Beracha is not recited when the miracle occurs – though quite obviously, one should express his gratitude to G-d immediately after experiencing a miracle – but only when he later sees the site of the miracle.
This requirement applies only if a person experienced a supernatural occurrence, but not when he was saved from danger through ordinary, natural causes. For example, if a person was robbed by an armed burglar, and he emerged unscathed, he does not recite this Beracha, because he was not saved through a supernatural occurrence. Even if somebody was present when a violent crime was committed, where shots were fired, and he was not harmed, although he should certainly be grateful to G-d for saving him from harm, he does not recite a Beracha when he later returns to that location, because no miracle took place. If, however, a bullet pierced his body near his heart, and he survived, then perhaps he would be required to recite this Beracha.
The Poskim debate the question of whether this Beracha is required when one survives a fall from a height. Rabbi Moshe Ha’levi (Israel, 1961-2000), in Birkat Hashem, and Hacham David Yosef, in Halacha Berura, rule that surviving a fall does not constitute a miracle, and thus does not warrant the recitation of this Beracha. They write that if one falls off a roof, or is in a car accident, even if the car flips over several times, he does not recite this Beracha when he visits the site of the fall or the accident. These Poskim also rule that if a person was being chased by wolves, and then somebody came and shot the wolves to save him, he does not recite this Beracha when he visits that location.
Hacham Ovadia Yosef, however, disagrees. He follows the ruling of the Hafetz Haim (Rav Yisrael Meir Kagan, 1839-1933) in Sha’ar Ha’siyun (218:29) that surviving a fall from a tall height constitutes a miracle and warrants the recitation of this Beracha. Surviving a fall from a rooftop, for example, occurs only as a result of a remarkable and unexpected turn of events, and thus it warrants the recitation of the Beracha when one visits the site of this miracle.
This question became practically relevant for the group from our congregation – in which I was included – that visited Morocco several years ago and survived a serious accident. The car in which we were riding veered off the road and fell into the ravine below, and remarkably, we all emerged from the accident unscathed. When the mayor of the town visited the site of the accident and saw us, he asked, "Where are the dead people?" We replied, "We are the dead people." He exclaimed, "G-d is great" – acknowledging that an extraordinary miracle had just occurred. It is clear to me that if any of us who experienced this miracle would ever return to that site, we would be required to recite the Beracha, "She’asa Li Nes Ba’makom Ha’zeh." (At the time this happened, we did not recite the Beracha, as mentioned above, but we did say, without Hashem’s Name, "Baruch She’asa Li Nes" – "Blessed is He who performed a miracle for me.")
The first person to recite this Beracha was Yosef. The Midrash relates that after Yosef and his brothers brought their father’s remains for burial in the Land of Israel, as they made their way back to Egypt, Yosef visited the pit into which his brothers had cast him many years earlier, and he recited the Beracha, "She’asa Li Nes Ba’makom Ha’zeh." The Talmud (Shabbat 21) teaches that when the Torah describes this pit as not containing any water, it means that the pit had no water, but it did have snakes and scorpions. Snakes and scorpions are both deadly creatures (the Gemara elsewhere teaches that snakes attack people who fall on them, and scorpions in any event are dangerous), and so it was clearly a miracle that Yosef emerged from the pit unharmed. Interestingly, the Gemara brings this comment about the pit immediately after citing the Halacha requiring kindling the Hanukah lights lower than a height of 20 Amot, as candles lit at such a tall height are not easily seen, and thus do not effectively publicize the Hanukah miracle, as the Misva requires. The simplest explanation for why these two passages are cited in conjunction with one another is because they were both taught by the same Rabbi, and often, after the Gemara cites a Rabbi’s teaching, it will cite his other teachings, even if they are unrelated to the original passage. On a deeper level, however, the Gemara here perhaps draws an association between our publicizing of the Hanukah miracle, which was performed for the entire Jewish Nation, and the celebration of one’s private miracle, just as Yosef recited a Beracha when he visited the pit where he experienced a great miracle.
Summary: If a person was saved from danger through a miracle, then when he later visits the site where the miracle occurred, he recites the Beracha, "Baruch Ata Hashem Elokenu Melech Ha’olam She’asa Li Nes Ba’makom Ha’zeh." This Beracha is recited only if one had not seen the location in thirty days (not including the previous and current visits). This requirement applies if one experienced a supernatural event, such as if he survived a fall from a rooftop, or a serious car accident during which the car flipped over or fell into a ravine. But if he was saved through natural means, such as if he was robbed by an armed burglar who did not harm him, or even if he was present at the site of a shooting and was not struck by bullets, no Beracha is recited when he later returns to the site.