The foundational category for military conscription in halacha is the distinction between a milchemet mitzvah (an obligatory war) and a milchemet reshut (a discretionary war), a distinction already embedded in the paradigm of the Midianite campaign where Moshe mustered a thousand men from every tribe (Bamidbar 31:3-6). The Mishnah rules that in a milchemet reshut the normally exempted classes are excused, but in a milchemet mitzvah everyone must go out, even a groom from his chamber and a bride from her canopy (Mishnah Sotah 8:7, Sotah 44b:2), a ruling the Rambam codifies by defining milchemet mitzvah as wars of the seven nations, Amalek, or rescuing Israel from an attacking enemy, which require no court sanction since the king may lead the nation out on his own volition (Mishneh Torah, Melachim and Wars 5:1-2).
Once a person has entered the ranks of such a war, the Rambam describes the posture required of him: he must rely on the Rock of Israel, know that he fights for the sanctification of God's name, place his life in his own hands, and banish all thought of wife, children, or fear, since one who lets himself become terrified transgresses a prohibition rooted in the pasuk "let not your heart faint, fear not, nor be alarmed" (Mishneh Torah, Melachim and Wars 7:15).
A contemporary application of the milchemet mitzvah category to the modern State of Israel appears in the analysis that classifies essentially all of Israel's wars as milchemot mitzvah because they are fought to save Jews from attacking enemies, which under the Mishnah's own distinction means the exemptions do not apply and all must fight, and this is reinforced by the Keren Orah's statement that even Torah scholars must interrupt their studies for a milchemet mitzvah (Gray Matter I, The State of Israel, Should Yeshivah Students Serve in the Israeli Army?). In a parallel vein, Peninei Halakhah, The Nation and the Land 4:4 holds that the IDF's mission of rescuing Israel from its enemies and securing Jewish sovereignty in the land makes conscription a mitzvah incumbent on every Jew who is called upon, with even training and enlistment themselves constituting fulfillment of that mitzvah because they deter enemies from attacking.
Igros Moshe (Igros Moshe YD 4:33) addresses the competing claim of Torah study, holding that for one devoted to becoming great in Torah, learning in yeshiva, which requires grasping the reasoning behind the law through study with talmidei chachamim, takes precedence over military service, since Torah is the foundation of the mitzvot and of the world's proper conduct.
Heichal Yitzchak (Heichal Yitzchak EH 2:34) takes up a related practical consequence of conscription, addressing the need to arrange a get for a man departing for military service, in a letter dated 22 Iyar 5699.
Beyond the basic obligation to serve, the sources also treat the practical halachic consequences of being enlisted: a kohen drafted into the army who killed in the course of battle is nevertheless eligible to perform nesi'at kapayim, since he acted under constraint comparable to a case discussed by the Pri Chadash (Gray Matter III, Israel, Israeli War Veterans and Nesi'at Kapayim), and Igros Moshe YD 4:9 rules that drafting women or unmarried women into army service or other government service violates Torah law and that such a decree may not be complied with.
Several halachic works further detail how a soldier's active duty status affects other obligations: Maamar Mordechai Hilchot Taaniyot U'Vein HaMetzarim 25:17 exempts a soldier on an operational mission or on standby from fasting, while one not on such duty remains obligated in the full laws of the fast, and Maamar Mordechai Hilchot Taaniyot U'Vein HaMetzarim 25:18 permits a soldier serving in a non-Jewish army to eat on Tisha B'Av if he must perform exhausting exercises that are difficult to do while fasting. Related rulings address a soldier's quarters as a temporary rental for purposes of chametz removal (Maamar Mordechai Hilchot Taaniyot U'Vein HaMetzarim 33:20), the permissibility of wearing an identification tag outdoors on Shabbat while on duty (Kitzur Shulchan Arukh Yalkut Yosef, Orach Chaim 329:25), and the preferred way to handle a command to shave on Shabbat in a non-Jewish army (Kitzur Shulchan Arukh Yalkut Yosef, Orach Chaim 340:8).
The age at which one becomes eligible to go out to war is itself rooted in the pasuk, since Rashi teaches that no one goes out in the army under twenty years old (Rashi on Bamidbar 1:3), and the Kli Yakar explains that this threshold reflects liability before the heavenly court, which makes a twenty-year-old more careful in his deeds and more likely to merit protection in battle, rather than mere physical strength (Kli Yakar on Bamidbar 1:3); the Chizkuni similarly describes the men chosen for such roles as men of valor with the strength to bear the burden without fear (Chizkuni, Shemot 18:21).
Beyond the strictly legal framework, the notion of military mustering is also used homiletically: the Shem MiShmuel observes that the wars of the Shoftim were all milchemet mitzvah fought to defend Israel (Shem MiShmuel, Shoftim 2), and a Chassidic discourse likens the total self-abnegation of mesirut nefesh to a person entering an army and relinquishing himself entirely to a master, from which it derives that accepting the yoke of Heaven is itself a kind of enlistment in the spiritual armies of God (Maamarim Melukatim אור ליום ג', יו"ד כסלו ה'תשמ"א).
Sdei Chemed, Divrei Chachamim Responsa 6 points to a further discussion elsewhere in that work bearing on this subject matter.