Positive commandment · Mitzvat Aseh #221 of 613
To carry out the procedure [the Torah] prescribes for a yefat to'ar
לעשות ליפת תואר ככתוב
The verse · Devarim 21:11
וְרָאִיתָ בַּשִּׁבְיָה אֵשֶׁת יְפַת־תֹּאַר וְחָשַׁקְתָּ בָהּ וְלָקַחְתָּ לְךָ לְאִשָּׁה
“and thou seest among the captives a beautiful woman, and hast a desire to her, that thou wouldst have her to thy wife;”
The Rambam’s words
To carry out the procedure [the Torah] prescribes for a yefat to'ar, as [Deuteronomy 21:11] states: "And if you see a beautiful woman among the captives...."
לעשות ליפת תואר ככתוב, שנאמר: "וראית, בשביה, אשת, יפת תואר" (דברים כא,יא).
Why · Sefer HaChinuch #532
To execute the law of the one of beautiful form (yefat toar) as is written in the Torah
“From the roots of the commandment [is that which] they, may their memory be blessed, said (Kiddushin 21b), [it is] because the Torah only permitted the one of beautiful form of the captives in view of the evil impulse.”
Who & when
“And this commandment is practiced at the time that Israel is on its Land, as then did they have the power and the ability in their hand to fight wars.”
Where in the Mishneh Torah
Hilchot Kings and Wars הלכות מלכים ומלחמות