Throughout his political career, Lincoln flipped on a myriad of positions regarding slavery and what should be done about it. It's generally agreed upon that he was a Moderate Republican, in the sense that he was torn between the Radical Republicans who wanted full emancipation and punishment of the Confederacy (think Thaddeus Stevens), and the "Copperheads" (anti-war Democrats), in conjunction with pro-Southern congressmen, either hated Lincoln's guts, or actively plotted to have him assassinated. In an 1854 letter written to Joshua Speed, a personal friend who owned slaves in Kentucky, Lincoln lamented at the notion of patriotic Northerners who cherished the Constitution and the Union being indifferent, or outright complicit, in the oppression of enslaved Africans:
"You ought rather to appreciate how much the great body of the Northern people do crucify their feelings, in order to maintain their loyalty to the Constitution and the Union. … How can any one who abhors the oppression of negroes, be in favor of degrading classes of white people? Our progress in degeneracy appears to me to be pretty rapid. As a nation, we began by declaring that "all men are created equal." We now practically read it "all men are created equal, except negroes." When the Know-Nothings get control, it will read "all men are created equal, except negroes, and foreigners, and catholics.""
Meanwhile during his presidential debates against Stephen A. Douglass in 1858, Lincoln was criticized for being inconsistent on his position. At his first debate in Illinois, Lincoln said that there was "no reason in the world why the negro is not entitled to all the natural rights enumerated in the Declaration of Independence, the right to life, liberty, and the pursuit of happiness." But at a separate speech in Illinois, he clarified that he was not, "nor ever have been in favor of bringing about in any way the social and political equality of the white and black races [applause]—that I am not nor ever have been in favor of making voters or jurors of negroes, nor of qualifying them to hold office, nor to intermarry with white people; and I will say in addition to this that there is a physical difference between the white and black races which I believe will for ever forbid the two races living together on terms of social and political equality."
Years later in 1862, Lincoln wrote a letter to Horace Greeley, editor of the New York Tribune, in response to accusations that his administration seemed far less concerned on preserving the Union, as they had been losing repetitious battles against the Confederacy since April 1861. He emphasized that his "paramount object is this struggle is to save the Union, and is not either to save or to destroy slavery." While he frames emancipation as a potential means to save the Union in the letter, the final segment of it effectively leaves little ambiguity as to Lincoln's position on slavery and emancipation:
"I have here stated my purpose according to my view of official duty; and I intend no modification of my oft-expressed personal wish that all men every where could be free."
That final remark leads historians to believe that Lincoln's inconsistency on his policies were largely rooted in his personal struggle to further his personal desire to end slavery forever, all the while preserving the Union and keeping its majority White population, which in the mid-19th century were technically "racist" by our modern social standards, loyal to the Constitution and the Union for the war.
So in general, while Lincoln definitely shifted his positions, changed his mind, and danced across several of the criticisms levied against him, it is still historically correct that he wanted to end slavery, emancipate the slaves themselves, and to preserve the Union.
For further reading, I personally recommend Father Abraham: Lincoln's Relentless Struggle to End Slavery by Richard Striner. There's also a massive archive of primary source documents from his life all across the internet, so you can get the real words spoken and written by the man himself.