(Numbers 27:1:) "Then the daughters of Zelophehad drew near." In that generation, the women were building fences where the men were breaking through. For so you find that Aaron said to them (in Exodus 32:2), "Take off the golden rings"; but the women were unwilling, and they protested against their husbands, as it is said (in the same place, verse 3), "And all the people took off the golden rings that were in their ears." So the women did not take part in the deed of the calf. Likewise, regarding the spies who spread an evil report and "made all the congregation murmur against him" (Numbers 14:36)—against them the decree was decreed, for they said, "We are not able to go up" (Numbers 13:31); but the women were not with them in that counsel. What is written above on this matter? "For the Lord had said of them, They shall surely die in the wilderness, and there was not left a man of them" (Numbers 26:65)—"a man," and not a woman, for they did not wish to enter the land. But the women drew near to seek an inheritance in the land. Therefore the portion of Midian was written next to this portion: that what the men broke through, the women fenced in.
Daughters of Zelophehad and the Women Who Built Fences
Midrash Tanchuma Buber, Pinchas 7:1
ותקרבנה בנות צלפחד (במדבר כז א). אותו הדור היו הנשים גודרות מה שהאנשים פורצין, שכך אתה מוצא שאמר להם אהרן, פרקו נזמי הזהב (שמות לב ב), ולא רצו הנשים ומיחו בבעליהן, שנאמר ויתפרקו כל עם את נזמי הזהב אשר באזניהם (שם שם ג), והנשים לא נשתתפו במעשה העגל, וכן במרגלים שהוציאו דיבה וישובו וילנו עליו [את] כל העדה (במדבר יד לו), עליהם נגזרה גזירה, שאמרו לא נוכל לעלות (שם יג לא), אבל הנשים לא היו עמהם בעצה, מה כתיב למעלה מן הענין, כי אמר ה' להם מות ימותו במדבר ולא נותר מהם איש (שם כו סה), [איש] ולא אשה, על מה שלא רצו להכנס לארץ, אבל הנשים קרבו לבקש נחלה בארץ, לכך נכתבה פרשת מדין לפרשה זו, שמה שפרצו האנשים גדרו הנשים.