"And you shall set apart every firstling of the womb to the LORD" (Exodus 13:12). In three places the firstborn were sanctified: in the land of Egypt, in the wilderness, and at their entry into the land. In the land of Egypt, "Sanctify to Me every firstborn" (Exodus 13:2); in the wilderness, "For every firstborn is Mine" (Numbers 3:13); and at their entry into the land, "And you shall set apart every firstling of the womb to the LORD." One might think I have a firstling among animals only when it is a fully formed offspring. From where do we learn the sign of an animal's offspring? In a small animal, a discharge; in a large animal, an afterbirth; and in a woman, a sac and the afterbirth of a beast that drops its young, anything that the animal expels. "And you shall set apart every firstling of the womb to the LORD": this excludes one born through the side [by Caesarean]. "The males": this excludes the case of doubtful or double sex [tumtum and androgynous]. "Shall be the LORD's": this excludes a female. Ben Azzai says: "setting apart" is stated here and "setting apart" is stated regarding the tithe. Just as in the "setting apart" stated regarding the tithe sanctity takes hold upon it even if it bears a permanent blemish, so too in the "setting apart" stated here sanctity takes hold upon it even if it bears a permanent blemish. Rabbi Shimon says: one that is not yet of valid age enters the pen and is treated like a firstborn. Just as we find with the firstborn that it is sanctified before its proper time, even though it is offered only in its time, so too this is sanctified before its time, even though it is offered only in its time. Rabbi Yehoshua ben Korhah says: "every firstling of the womb is Mine" (Exodus 34:19) is a general statement. One might think this includes the firstling of others; therefore Scripture says "your cattle." One might think it includes a female; therefore Scripture says "male." One might think it includes the firstling of a beast or the firstling of an ox. This is a general statement that requires its specification.
The Three Sanctifications of the Firstborn Animal
Mekhilta DeRabbi Shimon Ben Yochai 13:11
והעברת כל פטר רחם לה' בשלשה מקומות נתקדשו בכורות בארץ מצרים ובמדבר ובכניסתן לארץ: בארץ מצרים קדש לי כל בכור (י"ג ב'): במדבר כי לי בל בכור (במדבר ג' י"ג): ובכניסתן לארץ והעברת כל פטר רחם לה': יכול אין לי פטר בבהמה אלא ולד גמור, מנין סימן לולד בהמה דקה טינוף ובגסה שליא ובאשה שפיר ושליה של שגר בהמה. כל שהבהמה שוגרת: והעברת כל פטר רחם לה'. פרט ליוצא דופן: זכר. פרט לטומטום ואנדרגינס: יהיה לך. פרט לנקיבה: בן עזאי אומר נאמר כאן העברה ונאמר העברה במעשר מה העברה האמורה במעשר קדושה חלה עליו ועל בעל מום קבוע אף העברה האמורה כאן קדושה חלה עליו ועל בעל מום קבוע ר' שמעון אומר מחוסר זמן נכנס לדיר והרי הוא כבכור מה מצינו בבכור שקדש לפני זמנו אף על פי שאינו קרב אלא בזמנו אף זה יקדש לפני זמנו אף על פי שאינו קרב אלא בזמנו: ר' יהושע בן קרחה אומר כל פטר רחם לי (ל"ד י"ט) הרי זה כלל, יכול אף של אחרים ת"ל מקנך יכול אף של נקבה ת"ל תזכר, יכול של חייה של פטר שור, זה הוא כלל שצריך לפרטו: