Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:4:22

And do not marry those ˹women˺ whom your fathers married, except what has already occurred. Indeed, it was an immorality and hateful ˹to Allah˺ and was evil as a way.  

And do not marry women whom (mā means man) your fathers married, unless it be a thing of the past, which is forgiven you; surely that, marrying them, is obscene, vile, and abominable (maqtan, means it results in maqt, ‘severe hate’, from God), an evil way, ˹an evil˺ path is this.
القرآن:٤:٢٢

وَلَا تَنْكِحُوا مَا نَكَحَ آبَاؤُكُمْ مِنَ النِّسَاءِ إِلَّا مَا قَدْ سَلَفَ ۚ إِنَّهُ كَانَ فَاحِشَةً وَمَقْتًا وَسَاءَ سَبِيلًا  

{ولا تنكحوا ما} بمعنى من {نكح آباؤكم من النساء إلا} لكن {ما قد سلف} من فعلكم ذلك فانه معفوّ عنه {إنه} أي نكاحهن {كان فاحشة} قبيحا {ومقتا} سببا للمقت من الله وهو أشد البغض {وساء} بئس {سبيلا} طريقا ذلك.