Rabbi Herschel Schachter
The Jewish Army
The Torah tells the soldiers of the Jewish army not to fear the enemy (Devorim 20:3). Rambam understands this as a prohibition, i.e., it is forbidden for the soldiers to be afraid. Rambam obviously understood that it is possible for one to control his emotions, to the extent that one can be commanded not to fear. Raavad disagrees and understands the posuk as a promise, i.e. the Torah is telling us that there will be no need for the soldiers to be afraid. (See Rambam's listing of the mitzvos , Prohibition No. 58).
The pasuk continues and says that there will be no need to be afraid because Hashem will be with the Jewish army, saving them and fighting on their behalf. This theme is repeated again in parshas Ki Teitze (23:14-15), where the soldiers are commanded to be careful to have a clean camp, and to dress properly out of respect for the shechinah. The rabbis of the Talmud also applied these laws (of cleanliness and proper dress) to one who is praying or learning Torah, but the original source in the chumash is regarding the soldiers who are fighting "G-d's battles". When a minyan gathers to recite kaddish, kedushah, or barechu, we consider that a "davar shebikdushuah". The Rabbis derived from the chumash that whenever ten Jews gather together for a davar shebikdushah that the shehcinah will be present. The Jerusalem Talmud (end of first chapter of Ervuvin) understands that only if there are ten soldiers together does the group have the status of "an army camp." The minyan who are fighting "G-d's battles" constitute a Davar Shebikedusha, and the Torah promises that the Shechinah will be with them. The Chazon Ish points out that these ten soldiers have to be such individuals who can be mitztareph (included) in a minyan.
The Rabbis of the Mishna had a further tradition that individuals who were ba'alei aveira (sinners) were not taken into the army (see Rashi to Devarim 20:8). The success of the Jewish army depends on the participation of the Shechinah, and the Shechinah will only feel comfortable amongst a minyan of tzadikim.