Jefferson's opposition to slavery was both moral and practical in nature. He was clearly aware that human bondage was incompatible with his views on personal liberty, and referred to slavery as a "moral and political depravity." Perhaps more fundamentally, he was very concerned about the political and security ramifications associated with maintaining a large slave population. The Haitian Revolution in particular was very alarming to Jefferson, and although he did argue for abolition, this was with the intent of then "deporting" the former slaves to someplace else, he did not feel that the two races could co-exist peacefully:
They should continue with their parents to a certain age, then be brought up, at the public expense, to tillage, arts or sciences, according to their geniuses, till the females should be eighteen, and the males twenty-one years of age, when they should be colonized to such a place as the circumstances of the time should render most proper...to declare them a free and independent people, and extend to them our alliance and protection
It will probably be asked, why not retain and incorporate the blacks into the state, and thus save the expense of supplying by importation of white settlers, the vacancies they will leave? Deep rooted prejudices entertained by thw whites; ten thousand recollections, by the blacks, of the injuries they have sustained; new provocations; the real distinctions which nature has made; and many other circumstances, will divide us into parties, and produce convulsions, which will probably never end but in the extermination of the one or the other race.
Notes on the State of Virginia.
So if he believed all this, why didn't he free all of his slaves? Jefferson consistently pushed for gradual abolition of slavery rather than a sudden emancipation, which he justifies by claiming that slaves are "incapable as children" and wouldn't be able to fend for themselves were they suddenly freed:
the idea of emancipating the whole at once, the old as well as the young, and retaining them here, is of those only who have not the guide of either knolege or experience of the subject. for, men, probably of any colour, but of this color we know, brought up from their infancy without necessity for thought or forecast, are by their habits rendered as incapable as children of taking care of themselves, and are extinguished promptly wherever industry is necessary for raising the young. in the mean time they are pests in society by their idleness, and the depredations to which this leads them. their amalgamation with the other colour produces a degradation to which no lover of his country, no lover of excellence in the human character can innocently consent.
Letter from Thomas Jefferson to Edward Coles, 25 August 1814
Although this is is moral argument, there's also a way more practical layer to this: he would be financially ruined if he suddenly freed all of his slaves. Indeed, most of his fellow planter-aristocrats would also be ruined. No one is going to individually free their slaves because they don't want to be poor, and this is something that Jefferson was acutely aware of:
I think it might be. but, as it is, we have the wolf by the ear, and we can neither hold him, nor safely let him go. justice is in one scale, and self-preservation in the other.
Jefferson further justifies his decision to retain slaves by arguing that even if he were to free all of his slaves, it would not end slavery:
I can say with conscious truth that there is not a man on earth who would sacrifice more than I would, to relieve us from this heavy reproach, in any practicable way. the cession of that kind of property, for it is so misnamed, is a bagatelle which would not cost me a second thought, if, in that way, a general emancipation and expatriation could be effected.
Letter from Thomas Jefferson to John Holmes, 22 April 1820
Jefferson believed slavery was wrong. But at the same time he didn't want to make (in his mind) a pointless sacrifice that wouldn't actually end slavery. It was a sort of paradox he continued to wrestle with, and likely leads into many of his justifications for not freeing his slaves.
Further Reading: