Anas bin Malik reported,

It is from the Sunnah that when a man marries a virgin while already having a non-virgin wife, he stays with the virgin for seven nights and then resumes the regular rotation. When he marries a non-virgin while already having a virgin wife, he stays with the non-virgin for three nights and then resumes the rotation.Abu Qilaba said, "If I wished, I could say that Anas traced this back to the Prophet ﷺ."Abdul-Razzaq said, Sufyan reported to us from Ayub and Khalid, and Khalid said, "If I wished, I could say that he traced it back to the Prophet ﷺ."

Bukhari 5214

Sahih

حدثنا يوسف بن راشد حدثنا أبو أسامة عن سفيان حدثنا أيوب وخالد عن أبي قلابة

عن أنس قال

من السنة إذا تزوج الرجل البكر على الثيب أقام عندها سبعا وقسم وإذا تزوج الثيب على البكر أقام عندها ثلاثا ثم قسم قال أبو قلابة ولو شئت لقلت إن أنسا رفعه إلى النبي ﷺ وقال عبد الرزاق أخبرنا سفيان عن أيوب وخالد قال خالد ولو شئت قلت رفعه إلى النبي ﷺ

البخاري 5214صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Marriage
Chapter
If one marries a previously married woman while having a virgin wife
Numbering
Darussalam 5214
Bukhari 5214