יפת תאר and כהנים
In this week's parsha we have the din of יפת תאר. The Rambam writes in Hilchos Melachim (8:4)
הכוהן מותר ביפת תואר בביאה ראשונה, שלא דיברה תורה אלא כנגד היצר; אבל אינו יכול לישא
אותה אחר כן, לפי שהיא גיורת.
A Kohen is permitted to have relations with a יפת תאר because the Torah only permitted it to appease the evil inclination, but he can not marry her because she is a convert
We see from here that the din of יפת תאר applies to a כהן. This is very interesting because the din of יפת תאר only applies to soldiers fighting in a war. The clear implication is that Kohanim fought in the army.
In fact, the Rambam earlier implies this as well. In פרק ז where he discusses who leaves the army, he writes the following:
המחזיר את גרושתו, והמארס אישה האסורה לו, כגון אלמנה לכוהן גדול, גרושה וחלוצה לכוהן הדיוט ...
Someone who remarries hios divorced wife or someone who marries a woman he is prohibited from marrying such as a Kohen Gadol and an widow a regular Kohen and a divorcee ...
Again the Rambam discusses Kohanim in the context of the army.
This seems to contradict that Rambam at the end of hilchos shemita where he seems to exempt Shevet Levi.
I looked in the Frankel Rambam and to my great surprise none of the standard commentaries on the Rambam discuss this issue. The only references were to sefarim I never heard of and have no access to.