It is from the Sunnah that when a man marries a virgin while already having a previously married wife, he stays with the virgin for seven nights and then divides his time equally. When he marries a previously married woman while already having a virgin wife, he stays with her for three nights and then divides his time equally.Abu Qilaba said, "If I wished, I could say that Anas traced this back to the Prophet ﷺ."
من السنة إذا تزوج الرجل البكر على الثيب أقام عندها سبعا وقسم، وإذا تزوج الثيب على البكر أقام عندها ثلاثا ثم قسم. قال أبو قلابة: ولو شئت لقلت إن أنسا رفعه إلى النبي ﷺ.
Bukhari narrated it in the Book of Marriage (5214) and Muslim narrated it in the Book of Breastfeeding (45:1416), both through the route of Sufyan, who said, "Ayub and Khalid Haddan narrated to us, from Abu Qilaba, from Anas," and he related it, and the wording given here is Bukhari's.Abu Qilaba said, "If I wished..." This is how it appears in Bukhari, but in both versions it says, Khalid said, "If I wished, I would say that he attributed it to the Prophet ﷺ."I say, it is indeed as he said, for it has come as a marfu narration, as in the hadith that follows.