Negative commandment · Lo Ta’aseh #162 of 613
That a high priest not have intercourse with a widow
שלא יבעול כוהן גדול אלמנה, ואפילו בלא קידושים, מפני שמחללה
The verse · Vayikra 21:15
וְלֹא־יְחַלֵּל זַרְעוֹ בְּעַמָּיו כִּי אֲנִי ה׳ מְקַדְּשׁוֹ
“Neither shall he profane his seed among his people: for I the Lord do sanctify him.”
The Rambam’s words
For a High Priest not to have sexual relations with a widow even outside the context of marriage, because by doing so he profanes her, as [Leviticus 21:15] states: "He shall not profane his progeny...." This [also] implies that he must not cause a woman eligible to marry a priest to become ineligible [as happens through the relations described above].
שלא יבעול כוהן גדול אלמנה, ואפילו בלא קידושים, מפני שמחללה, שנאמר "לא יחלל זרעו, בעמיו" (ויקרא כא,טו); הרי הוא מוזהר שלא לחלל כשרה.
Who & when
“And this commandment is practiced at the time of the [Temple] when we had a high priest.”
Where in the Mishneh Torah
Hilchot Forbidden Intercourse הלכות איסורי ביאה