(The narrator Isma'il said: I think ash-Sha'bi attributed this tradition to the Prophet)

The Prophet (ﷺ) said: Curse be upon the one who marries a divorced woman with the intention of making her lawful for her former husband and upon the one for whom she is made lawful.
Sunan Abi Dawud Book 12, Hadith 31