[And the priest of Midian had seven daughters.] But was all the praise of that righteous man that he should go after idolatry? Rather, Jethro contemplated doing repentance before Moses came, and he removed all the implements of idolatry and gave them to his neighbors. He said to them: "I am old, and I am unable to serve idolatry." And the people of his place rose up and excommunicated him, as it is said: "And the priest of Midian had seven daughters, and the shepherds came and drove them away." Was it possible that the priest of Midian, the chief of Midian, that they should drive them away? Rather, this comes to teach you that they excommunicated him, so that they would not shepherd his flock. And therefore his daughters went out to shepherd, and they drove away his daughters [like a divorced woman], as it is said: "And He drove out the man" (Genesis 3:24).
Why the Shepherds Drove Out Jethro's Daughters in Midian
Midrash Aggadah, Exodus 2:16
[ולכהן מדין שבע בנות.] וכי כל שבחו של אותו הצדיק להיות הולך אחר ע"ז, אלא הרהר יתרו לעשות תשובה עד שלא בא משה, והוציא כל תשמישי ע"ז ונתן לשכיניו, אמר להם זקן אני ואיני יכול לעבוד ע"ז, ועמדו אנשי מקומו ונידוהו, שנאמר ולכהן מדין שבע בנות ויבואו הרועים ויגרשום, אפשר היה כהן מדין אב מדין היאך גירשום, אלא ללמדך שנידוהו שלא יהיו רועים את צאנו, ולכך היו בנותיו יוצאות לרעות וגירשו את בנותיו [כאשה גרושה] כמו שנאמר ויגרש את האדם (בראשית ג' כ"ד):