How many days a must married couple refrain from intimacy after their baby is born?
Leviticus Ch. 12 says that it's 7 days if the baby is a boy, and 14 if a girl; (but she has to then immerse in mikvah, a ritual bath). (Then there's a lengthier stretch of time that she can't enter the Temple, but is permitted to her husband.)
Skip ahead to Leviticus Chapter 15. If a woman has a normal period (15:19) then she must abstain from her husband for seven days (counting from the start of the period), then take a ritual bath the next day, then she's fine. BUT (15:25), if the bleeding isn't "normal", she has to wait till it stops, then count seven clean days, then ritual bath.
By the year 400 or so, Judaism established that we don't always know exactly what's called "normal" bleeding or not, so to avoid problems, any menstrual-type bleeding requires cessation, then seven clean days, then a ritual bath before she is permitted to her husband once again. This applies to childbirth as well.
So practically today, it's end-of-bleeding (which I think is usually a few weeks) plus seven days, plus immersion.
My understanding is all laws aside, doctors today wouldn't recommend anything sooner than a few weeks, anyhow.
Aside from the seven days for a son and fourteen days for a daughter given in Tazria, it is normal to continue to bleed for weeks or even months following childbirth. One should certainly consult closely with one's rav to determine when the mother may begin counting seven clean days.
There is an established custom in some communities to separate for forty days following the birth of a son and for eighty days following the birth of a daughter, but there are those who condemn this custom as overly strict. Additionally, some authorities rule that one must separate from one's wife on the night of the forty-first day following the birth of a son and the night of the eighty-first day following the birth of a daughter. (Kitzur Shulchan Aruch 158:1-2)
Who in the world would feel like having intercourse only 7 days after childbirth? Most women as sore for much longer than that, and the uterus is far from at normal size. And most women bleed for far longer than that! It's actually a misinterpretation of Leviticus.
Orthodox Jews today follow a Talmudic law that starts the counting of days not from the actual birth, but from the first "clean" day after bleeding stops, so it ends up being around 6 weeks except in the case of an early miscarriage.Actual length of no-sex after childbirth = end of bleeding plus 7 days if the child was male, and end of bleeding plus 14 days for female or if gender wasn't known in the case of a miscarriage. The 40 and 80 days are a reference to a waiting period before going to the Temple in Jerusalem, which is no longer standing.