According to a BBC article I read (and I'm not taking sides here, just noting what I read), he said, "As the Founding Fathers said, it was the necessary evil upon which the union was built, but the union was built in a way, as [Abraham] Lincoln said, to put slavery on the course to its ultimate extinction."
https://www.bbc.com/news/world-us-canada-53550882
So...I get what he was trying to say (that the Union could never have been formed in the first place, because the South 100% refused to give up slavery if that was a condition of joining, so slavery was allowed to go on with the expectation that it would die out naturally*.)
Would I have worded it that way though? No. If tasked with conveying that sentiment I'd have said something like, "The regrettable fact is there would be no United States if the South had not been allowed to join despite being slavers. Extinction of that institution should have been our primary goal from the outset and the accomplishment of that outcome was the greatest moment in our history as a nation" (I feel this is much more representative of the state of affairs rather than trying to condense all that into the words, "necessary evil".)
*The cotton gin screwed that up massively.