Note: All verse quotations are from Breishit unless otherwise specified.
R' Yehudah says: Twin sisters were born with each tribe, and they married them. R' Nechemiah says: They [the wives] were Canaanites, and what does "his daughters" mean? His daughters-in-law, as a person does not refrain from referring to his daughters-in-law as his daughters. (Rashi, 37:35).
R' Yehudah brings a well known, but rather strange and disturbing, midrash. What could have motivated him to say it?
It seems the midrash was primarily developed as a response to the following textual problem.
At least two verses in Breishit mention Yaakov having multiple daughters: "And all his sons and all his daughters rose up to comfort him" (37:35), "...his sons, and his sons' sons with him, his daughters, and his sons' daughters, and all his seed he brought with him into Egypt" (46:7). But just one daughter (Dinah) appears in the list of 70 family members who went down to Egypt, in Breishit 46:8-27. How can only one daughter be listed, if more than one was alive at the time?
2. Pshat resolutions
Various ways have been suggested to resolve this contradiction using pshat. Here are several possibilities.
1) Rashi (46:7) assumes that the word "daughter" can also apply to other female relatives (the encounter between Yaakov and Lavan in Gilad is an example where terms for family members are used in this imprecise manner). Thus, Rashi says that in 46:7 "daughters" refers to one daughter (Dinah) and one granddaughter (Serach bat Asher). As quoted above R' Nechemiah in the midrash takes a very similar approach.
2) Ibn Ezra (46:7) suggests that "daughters" refers to Dinah's maidservants - women who grew up in Yaakov's house. (Similarly, in modern Hebrew "bat" means "girl" as well as "daughter". Perhaps Yaakov's household had one "daughter" but many "girls".)
3) Ramban (46:7) says that the plural word "daughters" can be used even if only one daughter is being discussed.
4) R' Elchanan Samet (shiurim on parshat hashavua, vol. 2, Vayigash) suggests that other actual daughters were present, but were not considered to be members of Yaakov's household, since once they got married they became members of other mens' households. This approach is especially attractive because it explains why one daughter (Dinah) IS mentioned. Quite likely she never got married, because most men at the time wouldn't have wanted to marry a woman who had been raped.
But the midrash has clear reasons for rejecting all of these resolutions. Of the four resolutions I just mentioned, the first three
are all variations of "Nu, sometimes the Torah is a bit imprecise because that's how people naturally talked, just deal with it". Clearly the midrash, which makes a drasha from every extra vav in a verse, cannot accept such an answer. The fourth explanation seems to work more cleanly with the text. But it implies that Yaakov's daughters irrevocably assimilated into their husbands' pagan Canaanite or Egyptian families, which is obviously a potential source for discomfort.
3. The midrashic resolution
If none of these answers is acceptable, then how can the midrash resolve the contradiction? There is one remaining "out" which the midrash uses. According to 46:26, the list of 70 people in Yaakov's family excludes "the wives of Yaakov's sons". If Yaakov's daughters were ALSO his sons' wives, then we have a straightforward explanation for why the daughters are not listed. This answer implies exactly what the midrash says: that the sons (at least some of them) married their sisters.
How do we know that these sisters were twins of the brothers, and not born at some other time? I think the best explanation for this follows from the following chronological considerations.
Just 14 years passed between Leah's marriage and Yaakov's leaving Haran. For much of that time Leah was successively pregnant with the 7 children mentioned in the verses, and for some more of the time she was barren (29:35). She could have born additional daughters after leaving Haran, but not for too long after, because these daughters had to become old enough themselves to marry and have several kids before moving to Egypt. In short, the number of daughter/wives Leah could have mothered from additional pregnancies is limited. As for the other wives, they are unlikely to have had many more pregnancies. Rachel was almost continuously barren, and it is not clear that Yaakov slept with Bilhah and Zilpah except when the real wives requested it. In summary, the extra daughters the midrash requires could not have been born from twelve additional pregnancies. Rather, they must have been twins (or triplets, etc.) of each other, and/or of the previously mentioned sons.
To solve the above textual problems, it's sufficient to say that just one of Yaakov's sons had a twin daughter who married her brother. That daughter, plus Dinah, make up the plural "daughters" in 46:7. But the midrash says that there were 12 twin daughters who married their brothers. By saying this, this midrash avoids another difficulty: how did Yaakov's sons marry Canaanites, if Yitzchak and Yaakov had been forbidden to do this, and there is no hint that the 12 sons returned to Haran to find wives? As things now stand, the brothers married nice frum Jewish girls from an upstanding family, not idolatrous foreigners.
Of course, we have not succeeded in explaining every detail of the midrash. The above problems would all be explained if one brother had two twin sisters, the next brother had no twins, and so on. Here the midrash makes an assumption with no basis in the pshat: that each of the pregnancies was exactly the same, one son and one daughter. But that assumption is quite minor, given how much of the midrash has already been explained using logical considerations.
My guess is that people are troubled by this midrash less due to its implausibility than due to the implication of incest. I think our discomfort can be minimized if we assume that each brother married a sister from a different mother - that is, a half-sister. Elsewhere (20:12), Avraham explicitly told Avimelech that he married his half-sister. Either Avraham told the truth here and righteous people like him did marry their half-sisters, or if he lied, presumably he claimed a family relationship that Avimelech would consider permissible. Based on this verse, the gemara rules that Noahides are permitted to marry their half-siblings, but not their full sisters (Sanhedrin 58a). Perhaps Yaakov's sons made a point of marrying only half-sisters as well.
If so, we now have an interesting explanation for another midrash. Rashi to 30:21 says that Dinah was originally destined to be born as a son, but Leah prayed to God and the male fetus was miraculously changed into a female one. Rashi says Leah's motivation was to spare Rachel the humiliation of having fewer sons (one) than either of the midwives (two), since only 12 sons were to be born overall. We can suggest that Leah had a different motivation, one which is absolutely necessary given the halacha and the assumption of 12 twins. If more than 6 out of 12 pairs of twins were from one mother, then not all sons would be able to marry a daughter who was a half-sister rather than a full sister.
This understanding does contradict a different midrash. Rashi on 46:10 says that the sister whom Shimon married was Dinah. However, Shimon and Dinah were full siblings! Perhaps we can say that this midrash views Shimon and Dinah as evil people - Shimon as shown by what he did to Yosef (he and Levi were likely the ringleaders in capturing Yosef, see here) and the city of Shechem, and Dinah as shown by Rashi's comments on 34:1. Shimon and Dinah did violate the Noahide prohibition on incest, but due to their evil characters, they didn't care. For a slightly different approach to how Shimon and Dinah married each other, see here.