Who is the zonah mentioned in the Torah, such that a kohen who has relations with her is lashed on account of zonah? According to the opinion of the Rambam in chapter 18 of Issurei Biah, anyone who is not a daughter of Israel, and even if she converted or was emancipated at less than three years and one day old; and similarly a daughter of Israel who had relations with a man whom she is forbidden to marry with a prohibition that applies equally to everyone—to the exclusion of if she is forbidden to him due to a prohibition of the priesthood, such as a widow to a Kohen Gadol or a divorcee to an ordinary kohen, she does not become a zonah, for from prohibitions of the priesthood she becomes a chalalah and not a zonah. However, regarding a prohibition that applies equally to everyone, such as those liable for karet, and even those liable for negative commandments, such as one who has relations with a mamzer, a Natin, or an Ammonite or Moabite convert, or even those liable for a positive commandment, such as an Egyptian or Edomite convert—when she has relations with him, she becomes a zonah. Similarly, one who has relations with a petzuah daka or a kerut shofkhah becomes a zonah and is forbidden to the priesthood, and a kohen who has relations with her is lashed on account of zonah, and if she was the daughter of a kohen, she is disqualified from eating terumah.
The Rambam gave a general rule in this matter: one who has relations with a man whom she is forbidden to marry with a prohibition that applies equally to everyone—to the exclusion of prohibitions of the priesthood because they do not apply equally to everyone as I have written; and to the exclusion of one who has bestiality with an animal, for even though she is liable to stoning, she does not become a zonah since she did not have relations with a man; and similarly one who has relations with a niddah, even though she is liable for karet, she does not become a zonah since she is not forbidden to marry him; and similarly one who has relations with a kedeshah, even though according to his system they are liable for lashes, nevertheless, since she is not forbidden to marry him, she does not become a zonah. And in all of these where she does not become a zonah, she is not disqualified from the priesthood, for this is dependent on that according to his system, that she who is disqualified from the priesthood is either a zonah or a chalalah, and only from prohibitions of the priesthood does she become a chalalah, and from other prohibitions she becomes a zonah.
And only one case is excluded from this rule: one who has relations with a chalal—even though she is permitted to marry him—nevertheless she becomes a zonah because it is written, "and he shall not profane his seed among his people," and we expound: just as he disqualifies a widow through his cohabitation, so too his seed, who are chalalim, disqualify any woman through their cohabitation from terumah and the priesthood [ibid. 69a], and since he disqualifies her from the priesthood, she is automatically a zonah as I have written. And with the system of the Rambam several of our teachers agreed: Rashi [ibid. 61a s.v. ve-shenivalah], and the Nimukei Yosef, and the Bartenura [ibid.], and the Rashba [ibid. 68a s.v. minalan hanei milei, for the prohibition of the priesthood is dependent on zonah, see there].
איזהו זונה האמורה בתורה שכהן הבא עליה לוקה משום זונה? לדעת הרמב"ם פי"ח מא"ב כל שאינה בת ישראל ואפילו נתגיירה או נשתחררה פחותה מבת ג' שגים ויום אחד, וכן בת ישראל שנבעלה לאדם שהיא אסורה להנשא לו איסור השוה בכל, לאפוקי אם אסורה לו מפני איסור כהונה כמו אלמנה לכה"ג וגרושה לכהן הדיוט – אינה נעשית זונה, דמאיסורי כהונה נעשית חללה ולא זונה, אבל באיסור השוה בכל כמו חייבי כריתות, ואפילו חייבי לאוין כמו הנבעלת לממזר ולנתין ולגר עמוני ומואבי, או אפילו חייבי עשה כמו גר מצרי ואדומי – כשנבעלה לו נעשית זונה. וכן הנבעלת לפצוע דכא וכרות שפכה – נעשית זונה ואסורה לכהונה, וכהן הבא עליה לוקה משום זונה, ואם היתה כהנת נפסלה מן התרומה. ונתן הרמב"ם כלל בזה: הנבעלת לאדם שהיא אסורה להנשא לו איסור השוה בכל, לאפוקי איסורי כהונה מפני שאינו שוה בכל כמ"ש, ולאפוקי הנרבעת לבהמה אע"פ שהיא בסקילה – לא נעשית זונה שהרי לא נבעלה לאדם, וכן הבא על הנדה אף שהיא בכרת – לא נעשית זונה שהרי אינה אסורה להנשא לו, וכן הבא על הקדשה אף שלשיטתו חייבים מלקות, מ"מ כיון שאינה אסורה להנשא לו – לא נעשית זונה. ובכל אלו שלא נעשית זונה – לא נפסלה לכהונה, דזה בזה תלי לשיטתו דהנפסלת לכהונה היא זונה או חללה, ורק מאיסורי כהונה נעשית חללה, ומשארי איסורים נעשית זונה. ורק מוצאת מכלל הזה הנבעלת לחלל – אע"פ שמותרת להנשא לו – מ"מ נעשית זונה משום דכתיב "ולא יחלל זרעו בעמיו", ודרשינן – מה הוא פוסל אלמנה בביאתו, אף זרעו נמי שהם חללים פוסלים כל אשה בביאתם מתרומה וכהונה [שם ס"ט.], וכיון שפוסלה מכהונה ממילא היא זונה כמ"ש. ולשיטת הרמב"ם הסכימו כמה מרבותינו: רש"י [שם ס"א ד"ה ושנבעלה], ונמק"י, והרע"ב [שם], והרשב"א [שם ס"ח בד"ה מנה"מ, דתלי איסור כהונה בזונה ע"ש].