They were contemporaries though they probably never met. Joseph was just 3 years older than Lincoln, and they both lived in Illinois at the same time for 5 years.
Both were born into poor farming families whose ancestors had arrived in America during the 1600’s. Both were hard working, country boys who achieved little formal schooling.
Lincoln’s had little interest in spiritual matters but went to church often with his parents. Joseph’s parents, on the other hand, did not regularly attend church, but Joseph was deeply concerned with spiritual matters such as achieving forgiveness of sins and his own salvation. As a boy Lincoln would often stand on a “stump” after church, repeating the sermon word for word and mimicking the mannerisms of the preacher. Joseph’s formal religious background was far smaller, but his curiosity and inflection much more.
Both went through a period of maturity and accomplishment from age 22 to 25. Lincoln began to be ambitious and began networking with people. Joseph translated the Book of Mormon, organized the Church, and sent out missionaries.
Lincoln worked his way up from hireling to store owner to lawyer to state politician to senator to President. Lincoln’s accomplishments followed the ideal path of the “American Dream,” rising from poverty to President gradually. Joseph’s curve of accomplishments was “almost vertical”, becoming a prophet essentially overnight, not over a period of time.
Lincoln believed in the impersonal, deterministic, uninvolved God of Calvinism, though that softened as he suffered through the Civil War. Joseph believed in a personable, loving, concerned God, which made it all the harder when he felt alone or abandoned by Him.
Lincoln believed in capitalism, the freedom for every man to determine his own place in life. (This was his main concern with slavery — the lack of personal economic freedom.) Joseph believed in material equality and even tried practicing consecration with his people. But more than economics, Joseph was concerned with the spiritual welfare of his people. Lincoln was concerned with free markets; Joseph was concerned with having a temple in each community.
Joseph Smith died at the young age of 38. If Lincoln had died at 38 he wouldn’t have been remembered for anything. Both died as martyrs to their causes.