The mitzva to study Torah does not override the mitzva to serve in the army, so it is a mitzva for yeshiva students to enlist. Indeed, there is a tradition of this happening in the times of Joshua and King David.
However, there may be a few particularly talented individuals who have the potential to truly serve the nation through their exceptional Torah study. Such individuals should defer their service, as long as the army does not need to draft them, while greatly honoring soldiers who put their lives on the line to fulfill the mitzva of defending the people and the Land. They must study prodigiously to prepare themselves to serve the community as teachers and rabbis. In this way, they will contribute directly to the state’s religious life, and indirectly to its security and development.