"When you go out to war <against your enemies> and you take them captive" (Deuteronomy 21:10). Our masters taught: one commandment draws along another commandment, and one transgression draws along another transgression. "And you see among the captives a beautiful woman <and you desire her>, and she shall shave her head" (Deuteronomy 21:11-12) — so that she will not find favor in his eyes. What is written after it? "When a man has two wives" (Deuteronomy 21:15) — two wives in the house, strife in the house; and moreover, the one is loved and the one is hated, or both of them are hated. What is written after it? "When a man has a defiant and rebellious son" (Deuteronomy 21:18). Whoever takes a beautiful captive — there comes out from them a defiant and rebellious son. For thus we find concerning David: because he desired Maacah daughter of Talmai king of Geshur when he went out to war, there came out from him Absalom, who sought to kill him, and lay with his wives before the eyes of all Israel and before the eyes of the sun; and on his account several myriads of Israel were killed, and he made dissension in Israel; and Shimei [son of Gera] and Sheba son of Bichri and Ahithophel and Mephibosheth and Ishbosheth were killed; and he set Ziba over all the house of Saul. And it is taught: Rabbi Yose says: Now, because the defiant and rebellious son ate a half-litra of meat and drank a half-log of wine, does the Torah say that he should go out to the place of stoning? Rather, the Torah perceived the end of the mind of the defiant and rebellious son — that his end is to consume his father's property together with the gluttons with whom he ate and drank, and he seeks what he is accustomed to and does not find it, and he goes out to the crossroads, and he kills and robs people. So the Torah said: let him die innocent and let him not die guilty, for the death of the wicked is pleasing for them and pleasing for the world. And what is written after it? "When a man has committed a sin worthy of death, and he is put to death" (Deuteronomy 21:22) — if he is saved from this one, he is not saved from that one. We have learned that one transgression draws along another transgression. Where do we learn that one commandment draws along another commandment? As it is said: "When a bird's nest happens to be before you <...> you shall surely send away <the mother> <...> that it may be well with you and you may lengthen your days" (Deuteronomy 22:6-7). After it, what is written? "[When you build a new house]" (Deuteronomy 22:8) — you will merit to build a house and to make a parapet. What is written after it? "You shall not sow your vineyard with mixed seed" (Deuteronomy 22:9) — you will merit a vineyard and to sow a field. What is written after it? "You shall not plow with an ox and a donkey <together>" (Deuteronomy 22:10) — you will merit oxen and donkeys. What is written after it? "You shall not wear a mingled fabric" (Deuteronomy 22:11) — you will merit fine garments of wool and of linen. What is written after it? "You shall make for yourself tassels" (Deuteronomy 22:12) — you will merit the commandment of fringes. What is written after it? "When a man takes a wife" (Deuteronomy 22:13) — you will merit a wife and children. We have learned that one commandment draws along another commandment. Therefore these passages were placed next to one another.
Why the Beautiful Captive Leads to a Rebellious Son in Ki Teitzei
Midrash Tanchuma Buber, Ki Teitzei 1:1
כי תצא למלחמה וגו' ושבית שביו (דברים כא י). שנו רבותינו מצוה גוררת מצוה ועבירה גוררת עבירה, וראית בשביה אשת יפת תאר [וגו'] וגלחה א ראשה (שם יא יב), כדי שלא תמצא חן בעיניו, מה כתיב אחריו, כי תהיין לאיש שתי נשים (שם שם טז), שתי נשים בבית, מריבה בבית, ועוד האחת אהובה, והאחת שנואה, או שתיהן שנואות, מה כתיב אחריו, כי יהיה לאיש בן סורר ומורה (שם שם יח), כל מאן דנסיב יפת תואר נפיק מינייהו בן סורר ומורה, שכן מצינו בדוד, על שחמד מעכה בת תלמי מלך גשור בצאתו למלחמה, יצא ממנו אבשלום, שביקש להרוג אותו, ושכב עם נשיו לעיני כל ישראל ולעיני השמש, ועל ידו נהרגו כמה רבבות מישראל, ועשה מחלוקת בישראל, ונהרג שמעי [בן גרא] ושבע בן בכרי, ואחיתופל, ומפיבושת, ואיש בשת, והשליט ציבא על כל בית שאול, ותניא ר' יוסי אומר וכי מפני שאכל בן סורר ומורה חצי ליטרא בשר, ושתה חצי לוג יין, אמר תורה יצא לבית הסקילה, אלא הגיעה תורה לסוף דעתו של בן סורר ומורה, שסופו לגמר נכסי אביו עם הסריקין שאכל ושתה עמהם, ומבקש לימודו ואינו מוצא, ויוצא לפרשת דרכים, והורג ומלסטם את הבריות, ואמרה תורה ימות זכאי ואל ימות חייב, שמיתתן של רשעים נאה להם ונאה לעולם, ומה כתיב אחיו, וכי יהיה באיש חטא משפט מות והומת (שם שם כב), אם ניצל מזה לא ניצל מזו, למדנו שעבירה גוררת עבירה, מצוה גוררת מצוה מניין, שנאמר כי יקרא קן צפור לפניך וגו', שלח תשלח וגו' למען ייטב לך והארכת ימים(שם כב ו ז), אחריו מה כתיב [כי תבנה בית חדש] (שם שם ח), תזכה לבנות בית ולעשות מעקה, מה כתיב אחריו, לא תזרע כרמך כלאים (שם שם ט), תזכה לכרם ולזרוע שדה, מה כתיב אחריו לא תחרוש בשור ובחמור (שם שם י), תזכה לשורים ולחמורים, מה כתיב אחריו, לא תלבש שעטנז וגו' (שם שם יא), תזכה לבגדים נאים מצמר ומפשתן, מה כתיב אחריו, גדילים תעשה לך (שם שם יב), תזכה למצות ציצית, מה כתיב אחריו, כי יקח איש אשה (שם שם יג), תזכה לאשה ולבנים, למדנו שמצוה גוררת מצוה, לכך נסמכו פרשיות אלו לאלו.