The Gemara (Berachos 60a) states that during the first 40 days after conception one may daven that an expectant mother give birth to a boy. After 40 days, the fetus has developed to the extent that the gender has been determined, and this tefillah is no longer relevant. Therefore, one who recites this tefillah after 40 days is considered to have offered a tefillas shav – a prayer in vain.
Mefarshim ask: Granted that after 40 days the gender of the baby has been determined, but why can one not daven that Hashem change the fetus’s gender from female to male? The Vilna Gaon (cited in Imrei Noam) and the Bechor Shor (Shabbos 21b) both give the same answer: One must not daven for a miracle that defies the laws of nature. Rav Akiva Eiger in his hagahos on Shulchan Aruch also cites the Sefer Chareidim as saying one should not daven for a neis (although he does not reference the aforementioned Gemara).
However we must ask an obvious question. We learn in this week’s parshah that Leah davened that Hashem change the gender of her fetus – from male to female – when she realized she was going to have a son, which would mean her sister Rachel would only be able to have one of the Shevatim. The Gemara tells us that Dina was actually already in Rachel’s womb and Yosef was in Leah’s, but Hashem switched them in response to Leah’s tefillos. But wasn’t Leah violating the rule that one shouldn’t daven for a miracle?
A similar question is raised pertaining to Chanukah. The Kol Bo (cited by the Rema, 187:4 and 682:1) states that if a person forgot to say Al Hanissim in the appropriate place during bentching he should add a special HaRachaman: “HaRachaman Hu yaaseh lanu nissim k’mo she’asah bayamim haheim…” (“The Merciful One should perform miracles for us as He did in those days…”) followed by the full nusach of Al Hanissim. Mefarshim ask: Since one should not daven for a miracle, how is it permitted to say this HaRachaman, a clear request for Hashem to perform nissim on our behalf?
The Bechor Shor (ibid.) answers that the rule that one should not ask for a neis applies only to nissim for individuals. One is permitted, though, to ask for nissim on behalf of the tzibur. Why the distinction? Because the reason one should not daven for a neis (according to the Bechor Shor) is due to the unworthiness of the petitioner. Since he is unworthy, davening for a neis is an exercise in futility and the tefillah is therefore a tefillas shav. Davening for the tzibur, however, is not pointless since there is reason to assume that the collective merits of the tzibur make it worthy of a neis.
The Bechor Shor also states that a gavra rabba is allowed to daven for a neis since it is not a tefillas shav. Indeed, Chazal tell us, “A tzaddik ‘decrees’ and Hashem fulfills!” (Kesuvos 103b).
The Yeshuos Yaakov (682:2) is of the opinion that a person should not ask for a neis because it may reduce his zechuyos. Accordingly, he draws a distinction between a neis b’nistar – one that no one will be aware of – and a neis mefursam – one that will be publicized.
A neis b’nistar causes a reduction in one’s zechuyos; therefore, one should not daven for it. A neis mefursam, on the other hand, won’t cause a reduction in one’s zechuyos because the public Kiddush Hashem that results from a neis mefursam actually brings additional zechuyos to the petitioner (offsetting any possible reduction of zechuyos caused by the performance of the neis itself). Since one does not stand to lose zechuyos from a neis mefursam, one may daven for such a neis. And since the nissim we ask for in the HaRachaman of Chanukah are nissim mefursamim – similar to the ones found in the story of Chanukah and Purim – it is an acceptable tefillah.