Chazon Ish (Rabbi Avraham Yeshaya Karelitz, 1878 - 1953, lived in Bnei Brak, Israel) on Sanhedrin #25
Imagine a case where an arrow or missile was launched towards many people and a person had the power to divert the arrow or missile so that it only killed one person rather than many. It is possible to argue that this case is not similar to giving over one person to a group of idol worshipers to be killed because in that case (the act of giving up the one person) is an act of achzarit (cruelty)...In our case, it is an act of haztalah (saving life) since one's intention is to save many...and only by chance, indirectly, will the one person die (because you diverted to arrow or missile).
הנני נשבע ומתחייב בהן צדקי לשמור אמונים למדינת ישראל לחוקיה ולשלטונותיה המוסמכים, לקבל על עצמי ללא תנאי וללא סייג עול משמעתו של צבא הגנה לישראל, לציית לכל הפקודות וההוראות הניתנות על ידי המפקדים המוסמכים ולהקדיש את כל כוחותיי ואף להקריב את חיי להגנת המולדת ולחירות ישראל.
Text of the Tekes Hashba’ah of Tzahal Soldiers –
"I swear and commit to maintain allegiance to the State of Israel, its laws, and its authorities, to accept upon myself unconditionally the discipline of the Israel Defense Forces, to obey all the orders and instructions given by authorized commanders, and to devote all my energies, and even sacrifice my life, for the protection of the homeland and the liberty of Israel."