Everyone agrees it’s a milchemet mitzvah — the live debate is only about timing.
Q. Do Zionist halachic authorities agree to draft yeshiva boys from their Torah study?
The sources are clear that serving in in the IDF, as any war of self-defense, is a milchemet mitzvah (obligatory war, Rambam, hil. M’lachim 5, 1)). It’s also undisputed that as such, everyone, including yeshiva boys, must participate (ibid 7, 4, explicit in Mishna Sota 8, 7). The only question is when and for how long? R. Zvi Yehuda Kook would give a subjective answer to each yeshiva boy who asked. In general, the army undoubtedly needs the yeshiva boys, but is willing to defer their draft to do the hesder program (deferring for about 1.5 years, and then serving 1.5 instead of 3 yrs.) or what’s called “hesder Merkaz” (serving a half a year while learning 9.5 years). The army gains because the Torah a boy has learned in one of the Zionist yeshivot motivates, and he’ll be a better soldier. As far as I know, when R. Avraham Shapira headed Merkaz HaRav after RZY Kook, he continued with the aforementioned arrangement, and I know many boys who learned there, and they all served Tzahal enthusiastically. R. Mordechai Eliahu felt that as long as a boy is learning strong, he should stay in yeshiva, and do the army upon leaving, which eventually just about everybody does in the Zionist yeshivot. Most Zionist roshei yeshivot agree more with the first opinion. It’s also clear from the Tanach and the Rambam that that’s what was done in the past and is seen as the original authentic Torah ideal, before being warped by the exile. How much more so during war, where over the last 3 years, when the same reservist soldiers (many of whom also prefer to learn Torah) have already been called 7 (!) times already, for hundreds of days away from their families, the great mitzvah & obligation to fight and defend Am Yisrael & eretz Yisrael, should be shared by all yeshiva boys as well. These sources also clearly obligate Haredi yeshiva boys as well as yeshiva boys (and how much more so YU students and young working men) abroad, as well.