Positive commandment · Mitzvat Aseh #191 of 613
To anoint a priest [who will address the people before] battle
למשוח כוהן למלחמה
The verse · Devarim 20:2
וְהָיָה כְּקָרׇבְכֶם אֶל־הַמִּלְחָמָה וְנִגַּשׁ הַכֹּהֵן וְדִבֶּר אֶל־הָעָם
“And it shall be, when you are come near to the battle, that the priest shall approach and speak to the people, and shall say to them,”
The Rambam’s words
To anoint a priest [who will address the people before] battle, as [Deuteronomy 20:2] states: "And it shall come to pass, when you approach the battle, the priest will come forward and speak to the people...."
למשוח כוהן למלחמה, שנאמר: "והיה, כקרבכם אל המלחמה; וניגש הכוהן" (דברים כ,ב).
Why · Sefer HaChinuch #526
Anoint a priest for war
“The root of this commandment is well-known — since the men of the war need strengthening at the time of war and since a man is heeded more when he is honored, the Torah commanded that the one appointed to strengthen [the troops] be from the priests, who are the select of the people.”
Who & when
“And this commandment is practiced by males at the time that the Land of Israel is in its inhabitation.”
Where in the Mishneh Torah
Hilchot Kings and Wars הלכות מלכים ומלחמות