What is the connection between giving birth and a sin offering? A fusion between classical sources and modern science.
(א) וַיְדַבֵּ֥ר ה' אֶל־מֹשֶׁ֥ה לֵּאמֹֽר׃ (ב) צַ֚ו אֶת־בְּנֵ֣י יִשְׂרָאֵ֔ל וִֽישַׁלְּחוּ֙ מִן־הַֽמַּחֲנֶ֔ה כָּל־צָר֖וּעַ וְכָל־זָ֑ב וְכֹ֖ל טָמֵ֥א לָנָֽפֶשׁ׃ (ג) מִזָּכָ֤ר עַד־נְקֵבָה֙ תְּשַׁלֵּ֔חוּ אֶל־מִח֥וּץ לַֽמַּחֲנֶ֖ה תְּשַׁלְּח֑וּם וְלֹ֤א יְטַמְּאוּ֙ אֶת־מַ֣חֲנֵיהֶ֔ם אֲשֶׁ֥ר אֲנִ֖י שֹׁכֵ֥ן בְּתוֹכָֽם׃
(1) The LORD spoke to Moses, saying: (2) Instruct the Israelites to remove from camp anyone with an eruption or a discharge and anyone defiled by a corpse. (3) Remove male and female alike; put them outside the camp so that they do not defile the camp of those in whose midst I dwell.

(א) וַיְדַבֵּ֥ר ה' אֶל־מֹשֶׁ֥ה לֵּאמֹֽר׃ (ב) דַּבֵּ֞ר אֶל־בְּנֵ֤י יִשְׂרָאֵל֙ לֵאמֹ֔ר אִשָּׁה֙ כִּ֣י תַזְרִ֔יעַ וְיָלְדָ֖ה זָכָ֑ר וְטָֽמְאָה֙ שִׁבְעַ֣ת יָמִ֔ים כִּימֵ֛י נִדַּ֥ת דְּוֺתָ֖הּ תִּטְמָֽא׃ (ג) וּבַיּ֖וֹם הַשְּׁמִינִ֑י יִמּ֖וֹל בְּשַׂ֥ר עָרְלָתֽוֹ׃ (ד) וּשְׁלֹשִׁ֥ים יוֹם֙ וּשְׁלֹ֣שֶׁת יָמִ֔ים תֵּשֵׁ֖ב בִּדְמֵ֣י טָהֳרָ֑ה בְּכָל־קֹ֣דֶשׁ לֹֽא־תִגָּ֗ע וְאֶל־הַמִּקְדָּשׁ֙ לֹ֣א תָבֹ֔א עַד־מְלֹ֖את יְמֵ֥י טָהֳרָֽהּ׃ (ה) וְאִם־נְקֵבָ֣ה תֵלֵ֔ד וְטָמְאָ֥ה שְׁבֻעַ֖יִם כְּנִדָּתָ֑הּ וְשִׁשִּׁ֥ים יוֹם֙ וְשֵׁ֣שֶׁת יָמִ֔ים תֵּשֵׁ֖ב עַל־דְּמֵ֥י טָהֳרָֽה׃ (ו) וּבִמְלֹ֣את ׀ יְמֵ֣י טָהֳרָ֗הּ לְבֵן֮ א֣וֹ לְבַת֒ תָּבִ֞יא כֶּ֤בֶשׂ בֶּן־שְׁנָתוֹ֙ לְעֹלָ֔ה וּבֶן־יוֹנָ֥ה אוֹ־תֹ֖ר לְחַטָּ֑את אֶל־פֶּ֥תַח אֹֽהֶל־מוֹעֵ֖ד אֶל־הַכֹּהֵֽן׃ (ז) וְהִקְרִיב֞וֹ לִפְנֵ֤י ה' וְכִפֶּ֣ר עָלֶ֔יהָ וְטָהֲרָ֖ה מִמְּקֹ֣ר דָּמֶ֑יהָ זֹ֤את תּוֹרַת֙ הַיֹּלֶ֔דֶת לַזָּכָ֖ר א֥וֹ לַנְּקֵבָֽה׃ (ח) וְאִם־לֹ֨א תִמְצָ֣א יָדָהּ֮ דֵּ֣י שֶׂה֒ וְלָקְחָ֣ה שְׁתֵּֽי־תֹרִ֗ים א֤וֹ שְׁנֵי֙ בְּנֵ֣י יוֹנָ֔ה אֶחָ֥ד לְעֹלָ֖ה וְאֶחָ֣ד לְחַטָּ֑את וְכִפֶּ֥ר עָלֶ֛יהָ הַכֹּהֵ֖ן וְטָהֵֽרָה׃ (פ)

(1) The LORD spoke to Moses, saying: (2) Speak to the Israelite people thus: When a woman at childbirth bears a male, she shall be unclean seven days; she shall be unclean as at the time of her menstrual infirmity.— (3) On the eighth day the flesh of his foreskin shall be circumcised.— (4) She shall remain in a state of blood purification for thirty-three days: she shall not touch any consecrated thing, nor enter the sanctuary until her period of purification is completed. (5) If she bears a female, she shall be unclean two weeks as during her menstruation, and she shall remain in a state of blood purification for sixty-six days. (6) On the completion of her period of purification, for either son or daughter, she shall bring to the priest, at the entrance of the Tent of Meeting, a lamb in its first year for a burnt offering, and a pigeon or a turtledove for a sin offering. (7) He shall offer it before the LORD and make expiation on her behalf; she shall then be clean from her flow of blood. Such are the rituals concerning her who bears a child, male or female. (8) If, however, her means do not suffice for a sheep, she shall take two turtledoves or two pigeons, one for a burnt offering and the other for a sin offering. The priest shall make expiation on her behalf, and she shall be clean.
(ב) דַּבֵּ֞ר אֶל־בְּנֵ֣י יִשְׂרָאֵ֘ל לֵאמֹר֒ נֶ֗פֶשׁ כִּֽי־תֶחֱטָ֤א בִשְׁגָגָה֙ מִכֹּל֙ מִצְוֺ֣ת ה' אֲשֶׁ֖ר לֹ֣א תֵעָשֶׂ֑ינָה וְעָשָׂ֕ה מֵאַחַ֖ת מֵהֵֽנָּה׃ (ג) אִ֣ם הַכֹּהֵ֧ן הַמָּשִׁ֛יחַ יֶחֱטָ֖א לְאַשְׁמַ֣ת הָעָ֑ם וְהִקְרִ֡יב עַ֣ל חַטָּאתוֹ֩ אֲשֶׁ֨ר חָטָ֜א פַּ֣ר בֶּן־בָּקָ֥ר תָּמִ֛ים לַה' לְחַטָּֽאת׃
(2) Speak to the Israelite people thus: When a person unwittingly incurs guilt in regard to any of the LORD’s commandments about things not to be done, and does one of them— (3) If it is the anointed priest who has incurred guilt, so that blame falls upon the people, he shall offer for the sin of which he is guilty a bull of the herd without blemish as a sin offering to the LORD.

שאלו תלמידיו את רבי שמעון בן יוחי מפני מה אמרה תורה יולדת מביאה קרבן אמר להן בשעה שכורעת לילד קופצת ונשבעת שלא תזקק לבעלה לפיכך אמרה תורה תביא קרבן.

The students of Rabbi Shimon ben Yohi asked: Why does the Torah say a new mother should bring sacrifice? He answered: When she is giving birth—lit. in the hour when she is kneeling in childbirth—she swears not to have relations with her husband Therefore, the Torah prescribes she bring sacrifice.

(א) והקריבו לפני ה' וכפר עליה וטהרה ממקור דמיה

ורבותינו אמרו (נדה לא) בשעה שכורעת לילד קופצת ונשבעת לא אזקק עוד לבעלי ועיקר הכונה בזה כי בעבור שהיא נשבעת מתוך הצער ואין השבועה ראויה להתקיים מפני היותה משועבדת לבעלה רצתה התורה לכפר לה מעלות רוחה ומחשבות השם יתברך עמוקות ורחמיו מרובים שהוא רוצה להצדיק בריותיו

Our Sages taught (Nidda 31b) that when a woman crouches to give birth, she determinedly swears: “I shall no longer have relations with my husband.” What this means, in essence, is that because her pain drives her to utter this oath, and her oath is not possible to honor anyway, since she is obligated to her husband, therefore the Torah seeks to offer her atonement for that passing mood. The thoughts of the blessed God are deep, and His mercy is abundant, in seeking to exonerate His creatures.

אברבנל יב

ומפני שאין אדם שעובר עליו צרה וצוקה בעולם הזה אם לא יחטא... והיולדת סבלה צרה וסכנה בהיותה על האבניים לכן הייתה מקריבה חטאת.

Abarbanel 12

There is no man that suffers in this world who did not sin. . . and the woman who gave birth suffered and was in danger in labor, therefore she has to bring a sin offering.

רבנו בחיי ויקרא י"ב, ז

ויתכן לפרש שאין הקרבן הזה מצד חטא של עצמה רק מצד אמה שהיא היתה אם כל חי, כי לולא החטא ההוא היה האדם מוליד עם אשתו שלא בדרך תאוה וחשק אלא בדרך הטבע הגמור, כטבע האילן המוציא פירותיו בכל שנה שלא בתאוה, והיולדת הזו כאמה בתה במעשה החטא, כי הענפים הם מקולקלים בקלקול השורש, ועל כן יצריכנה הכתוב קרבן לכפר על החטא הקדמוני...

And it is logical to explain that this sacrifice is not due to her own sin, rather due to the sin of the mother of all (Eve), because if she did not sin, then man and woman would procreate not with desire and lust but in a totally natural way, naturally like a tree that gives fruit every year without any desire, and this birthing woman, the daughter is like the mother in terms of her sin, because the branches are corrupted like the root is corrupted, and therefore the Torah requires a sin offering to atone for the primal sin.

Rabbanit Sharon Rimon

Quite simply, we do not think about childbirth in terms of “sin”; rather, we perceive it as a positive process. Is it not possible, then, that the sin offering brought by the women after childbirth is not the result of sin, but rather for some other reason?

ספרא ל"ה, ג

כל מקום שהיא באה על חטא הקדים חטאת לעולה. כאן, שאינה באה על חטא, הקדים עולה לחטאת.

Sifra 35:3

Wherever a sin offering is brought for a sin, the sin offering is mentioned before the burnt offering. Here, since it is not brought for a sin, the burnt offering is mentioned before the sin offering.

(א) והקריבו לפני ה' וכפר עליה וטהרה ממקור דמיה יאמר שתקריב כופר נפשה לפני ה' שתטהר ממקור דמיה כי האשה בלדתה תהיה לה מעין נרפס ומקור משחת ואחרי עמדה בימי הנקיון או בימי יצירת הולד לזכר או לנקבה תביא כופר נפשה שיעמוד מקורה ושתטהר כי השם יתעלה רופא כל בשר ומפליא לעשות

“…and he shall offer it before God and make atonement for her, and she shall be purified from the issue of her blood” – meaning that she offers a ransom for her soul before God to be purified from the issue of her blood. For a woman during childbirth experiences a sort of soiling, corrupting issue. After she has completed the days of purification, or during the time that the infant develops as a male or female, she brings a ransom for her soul in order to recover from her issue and to be purified, for the exalted God heals all flesh and performs wonders.

Rabbanit Sharon Rimon

The concept of impurity is abstract and therefore difficult to define. In the world of pure material, there is no impurity. Likewise, in the spiritual world that is completely cut off from the material world, there is no impurity. Impurity is manifest only in the connection between these two worlds. And what is common to all types of impurity is that they are brought about specifically through death. Impurity comes about where there is a separation of material from spirit. It is this parting that the state of impurity signifies.

The process of childbirth is the opposite of death. During birth, a new connection is made between the material world and the spiritual world, and a new life comes into being. Why, then, does this situation cause impurity?

The infant that is born, representing the new connection between material and spirit, is not impure. It is the mother who is rendered impure – not because of the newborn infant, but because of a “death” in a different sense. Firstly, while the infant has begun a new life, the mother has lost a life which, until now, has been contained inside her. Secondly, at the start of the embryo's development, some of the embryonic cells become the placenta, which takes root in the womb and nourishes the fetus during the pregnancy. At birth, the infant – emerging into new life – parts from the placenta. The placenta, which had started off as some of the embryonic cells, and later nourished the developing embryo and fetus and allowed it to grow, leaves the body, and in a certain sense one may say that it is dead.

Rabbanit Sharon Rimon

The birth process involves a huge, mighty collision between the material world and the spiritual world. It is no coincidence, it seems, that this collision comes about specifically amidst the process of birth. The creation of man is bound up with the special combination of material body, flesh and blood, and spiritual soul – the image of God. This combination is no simple matter, and it is therefore specifically at childbirth that the two worlds collide with such force. The woman is in the middle of this collision, a partner in this clash.

...

The woman experiences most powerfully the physical strain that her body endures, to the extent that she may sometimes become disconnected from the greatness of the process, and feel herself prepared to forego any further pregnancies.

...

Perhaps the Midrash is teaching us that she must bring a sin offering for this situation, in which the body (and its travail) conquers and dominates the spirit.