SHOULD ONE ENDANGER HIMSELF FOR KERI'AS SHEMA OR TEFILAH? [Tefilah: Piku'ach Nefesh]
(Beraisa): When R. Akiva was imprisoned, each day he received a small ration of water. One day, the warden spilled out half of it. R. Akiva used the water to wash before eating.
R. Yehoshua: There is not enough to drink. Will you use it to wash?!
R. Akiva: One who transgresses Divrei Chachamim is Chayav Misah. It is better that I die my 'own' death [from thirst] than to transgress their words!
Berachos 11a (Mishnah - R. Tarfon): I was on the road and lied down to say Shema, like Beis Shamai. I endangered myself due to bandits.
Chachamim: You were liable to die for transgressing Beis Hillel's opinion!
13a (Mishnah - R. Meir): In the middle of a Perek (a Parshah or Berachah of Shema), one greets someone whom he fears.
29a (Mishnah - R. Yehoshua): One may pray "like" Shemoneh Esreh.
(Rav): He says  abridged blessings;
(Shmuel): He says [the first three and last three blessings as usual; and] "Havinenu..." [all the middle Berachos condensed into one].
Abaye cursed one who would pray Havinenu [unless he was traveling].
32b (Mishnah): Even if the king greets a person during prayer, he does not answer.
(Rav Yosef): This refers only to a Yisrael king, but if a Nochri king greets him, he answers.
Question (Beraisa): If one was praying and saw an extortionist or wagon coming towards him, he does not interrupt. Rather, he shortens his prayer and leaves.
Answer: If it is possible to finish quickly, he does. If not, he interrupts.
(Beraisa): A case occurred in which a Chasid was praying on the road. A nobleman came and greeted him. He did not answer.
The nobleman (after the Chasid finished): "V'Nishmartem Me'od l'Nafshoseichem" -- you should have answered me! I could have killed you!
The Chasid: Wait until I appease you! If you were standing in front of the king, and your friend greeted you, and you answered him, what would they do to you?
The nobleman: They would kill me!
The Chasid: I was standing in front of the King of kings, who lives for all eternity. All the more so I should not interrupt!
The nobleman was appeased.
(Mishnah): Even if a snake wraps itself around his heel, he should not interrupt.
(Rav Sheshes): However, if a scorpion is about to sting him, he interrupts.
(R. Yitzchak): If bulls were coming towards him, he interrupts.
Rambam (Hilchos Kri'as Shema 2:16): In the middle of a Parshah, one greets only someone he fears, e.g. a king, extortionist or similar people.
Rosh (Berachos 2:5): Rashi says that 'due to fear' is someone whom he fears lest he kill him. This is wrong. [This is no Chidush, for] nothing overrides Piku'ach Nefesh [except for idolatry, Arayos and murder]. Rather, it refers to a parent or Rebbi.
Rosh (5:12) and R. Yonah (23a DH Lo): The Yerushalmi says that if one was praying in the market, he veers away due to a donkey or wagon, as long as he does not interrupt his Tefilah. Since he can save himself through distancing to the side, he may not interrupt and speak. For Nochri kings, he interrupts with speech. Since he should answer, there is no other solution. If he can distance to the side and be saved, he should do so, to avoid needing to speak.
R. Yonah (ibid.): If he can shorten his prayer, i.e. say the beginning and end of each Berachah before the king reaches him, he shortens. If he cannot, he interrupts, for nothing overrides Piku'ach Nefesh.
Shulchan Aruch (OC 66:1): In the middle of a Perek, one greets someone he fears, e.g. a parent... and all the more so a king or extortionist.
Taz (1): The Rosh and Rashba challenged Rashi, for it is no Chidush that one interrupts to greet one who might kill him. Berachos 32b teaches that one interrupts for a Nochri king! I answer that there, it did not say "due to fear lest he kill him immediately." A Stam king does not kill immediately, rather, he confronts him (Ploni) and says 'why did you do so?', and Ploni can explain. Surely the king will be appeased that Ploni was not rebelling, rather, he was honoring Hash-m. It is a Chidush that Ploni may interrupt, and not rely on his ability to appease the king. How did the Chasid answer the question from "v'Nishmartem..."? Even if you will say that the Chasid relied on the merit of his Tefilah, what was his answer? In any case, why did he say 'wait while I appease you'? He should have immediately started appeasing! Rather, he hinted 'surely you will wait, for rulers do not kill immediately. They first ask 'why did you do so?' Amidst this, I would be able to appease you. I did not transgress "v'Nishmartem"!' Even though the Rambam said 'king or extortionist', the Rosh asked that this is no Chidush, for [this discusses a king who kills immediately, like an extortionist]. I answer for Rashi, that he discusses fear of someone like the nobleman, lest he not be appeased. I question the Rosh, for we find that Yakov did not interrupt Shema when Yosef came to him, even though elsewhere Yakov honored Yosef because he was [like] a king! We can say that Yakov was in the first verse, during which one does not interrupt, like the Shulchan Aruch says.
Mishnah Berurah (9): Likewise, one may interrupt due to an informer.
Kaf ha'Chayim (10 and 104:4): One greets even a Yisrael king, for a verse commands to fear him. Only regarding Tefilah, the Mishnah says that one does not answer even the Nasi of Yisrael. For Keri'as Shema, one greets one whom he fears. The Bach says that Tefilah is more stringent than Keri'as Shema because we learn from "v'Dibarta Bam" (one may speak during Keri'as Shema), but not during Tefilah.
Shulchan Aruch (ibid.): One does not interrupt in the verse of "Shema Yisrael..." or Baruch Shem Kevod, unless he fears lest the person kill him.
Gra (DH Im): This is like Tefilah.
Mishnah Berurah (12): If one was reading after three hours, this is like [merely] reading in the Torah, so perhaps he must interrupt.
Shulchan Aruch (104:1): One may not interrupt his Tefilah, even if a Yisrael king greets him.
Mishnah Berurah (1): One may not even gesture during Tefilah, if not to quiet a crying child, so he will not disturb his Tefilah. If gesturing does not help, he distances himself. He does not interrupt with speech. If an esteemed person is distracted because the Shali'ach Tzibur is waiting for him to finish, he may gesture to the Shali'ach Tzibur not to wait for him.
Mishnah Berurah (2): If one was unsure about a law relevant to his Tefilah, Chayei Adam permits going to where there is a Sefer in which he can find the law. He was unsure if one may ask the law. It seems to me that he may.
Shulchan Aruch (ibid.): If it is a Nochri king, if he can shorten his prayer, i.e. say the beginning and end of each Berachah before the king reaches him, he shortens.
Magen Avraham (1): This is only if he fears lest he kill him. If he will only take his money, he does not interrupt (108:8).
Kaf ha'Chayim (6): Even if it seems that the king comes only for money, Mateh Yehudah says that Stam, one must be concerned that he will come to decree death if he does not interrupt.
Gra (DH d'Hainu): We must say that he shortens his prayer like Rav. (We discuss one who is in the middle of Tefilah, and already said Chonen ha'Da'as, so he cannot say Havinenu - Damesek Eliezer.)
Shulchan Aruch (ibid.): If he can veer to the side of the road without interrupting with speech, he does so. If he cannot, he interrupts.
Mishnah Berurah (4): The Bach and Eliyahu Rabah say that it is better to shorten his prayer than to go to the side. The Pri Megadim was skeptical, for walking for the sake of Tefilah is not an interruption.
Mishnah Berurah (5): One may even greet him if he estimates that it is dangerous not to.
Tif'eres Yisrael (Berachos 1:3 Yachin 25): The Rashdam (130:1) says that R. Tarfon praised himself for endangering himself. This is wrong. There was no Chiyuv to be Moser Nefesh. Do not say that a commoner who fulfills when he is exempt is called a Hedyot, but it is praiseworthy for a great person to do so. We hold like the Rambam, that one may not be stringent about Mesiras Nefesh when he is exempt! However, when the danger is not Vadai and damage is not common, the Mitzvah will protect him while doing it. We learn from R. Akiva, who entered Safek danger for Netilas Yadayim. He relied that the prison warden would not let him die of thirst, like it says in Eruvin. All the more so this applies to Keri'as Shema, which has Kidush Hash-m and Yichud Hash-m. Chachamim rebuked R. Tarfon, for roads are established to be dangerous.
Note: The Gemara does not hint that R. Akiva relied that the prison warden would not let him die of thirst. He said 'it is better that I die my own death than to transgress their words!'
Kaf ha'Chayim (7): Whenever there is danger, one must interrupt. He may not do like the Chasid did.