Poskim have nearly always come out against exchanges of terrorists for live prisoners (see for instance R Aviner, R Melamed and a detailed study from chabad), therefore even more so for bodies (see here a recent announcement from R Yaakov Ariel, R Dov Lior, R Chaim Druckman and R Shlomo Aviner).
The only justification I could find comes in an article from R Shlomo Brody
Interestingly, when Rabbi Goren later republished his essay, he
concluded like Rabbi Shaul Yisraeli, who believed that the government
must take full responsibility for its soldiers, deeming it analogous
to someone paying an exorbitant price to redeem themselves [...]
Scholars who permit such exchanges, however, note they are not
mandatory and are subject to various political and military
Unfortunately in Israel, at the time of your question, the debate is nearly entirely political, with political leaders responding to the families of the bereaved.