You’re right: it does seem contradictory. As Prof. Robert Paquette of Hamilton College will explore in a forthcoming book, Jefferson had become dedicated to the idea of bringing slavery to an end via “diffusion,” followed by state-level emancipation, by the time of the Missouri Crisis. Banning slavery from Missouri would mean that the Atlantic states would have skyrocketing slave populations, thus very little likelihood of ending slavery, and so to him this could only be harmful both to slaves and to masters.