The Gemara (Shabbat 156b) recounts an incident where astrologers told Rabbi Akiva that, based on the paths of the constellations and stars, his daughter was to be bitten by a snake and die on her wedding day. This caused Rabbi Akiva great distress.
On her wedding night, upon entering her room, Rabbi Akiva’s daughter removed a golden pin from her hair and stuck it between the bricks of the wall of the bedroom. In that exact place in the wall, a poisonous snake was hiding out, waiting to bite her. When she stuck the golden pin into the wall, she inadvertently stuck the pin into the snake’s eye, killing it immediately.
The next morning, Rabbi Akiva came to check on his daughter. As soon as she awoke and got dressed, she removed the golden pin from the wall and along with it came out the dead snake. It was only then that she realized the great miracle that she had experienced as a result of Hashem’s divine intervention. Rabbi Akiva inquired, “My daughter, please tell me what good deed you have performed.” She replied, “Yesterday, in the middle of my wedding celebration, I noticed a poor man enter the hall as you, father, were busy with the multitude of important guests who came to participate in the festivities and thus, no one paid attention to this pauper. I immediately got up from my place of honor and gave him my portion to eat and drink.” Rabbi Akiva exclaimed, “You are so fortunate to have performed this great Mitzvah which served to protect you and nullify the harsh decree that hovered upon you!”
Rabbi Akiva then expounded the verse, “And charity shall save from death”-Not only does charity (Tzedakah) save one from unusual deaths, it protects one from death in general, as the verse states, “One who pursues charity and kindness shall find life, justice, and honor.”
One must know that all Mitzvot protect those who perform them. Nevertheless, after some time, the merit of the Mitzvah weakens and does not protect as much. Indeed, the Tosafot (Baba Batra 9b) that even the merit of the Mitzvah of donating Tzedakah anonymously likewise has a limit and does not protect the individual for one’s entire life. Nonetheless, the saintly Ari z”l writes (see Nagid U’mtzaveh page 11a) that for any Mitzvah that an individual performs, the merit of the Mitzvah is inscribed on one’s forehead in the form of one of the letters of the Alef-Bet. This letter illuminates the forehead of the individual for a certain amount of time; however, after this allotted amount of time, the letter is absorbed into the individual’s forehead and vanishes while only the reward for the Mitzvah is kept for the World to Come. On the other hand, one who donates Tzedakah to the needy merits the letter “Tzadi” being inscribed on one’s forehead and remains illuminated for an entire week and it does not vanish like other letters reserved for other Mitzvot. Thus, the merit of the Mitzvah of Tzedakah protects one even when one is no longer involved in performing the Mitzvah.