I've read some commentary on this topic suggesting that many, if not most, Union soldiers were motivated to fight in the Civil War because they wanted to end slavery. But this analysis doesn't entirely make sense to me when considering the Draft Riots, in which Black people suffered violent reprisals from people who were being forced to fight ostensibly to end slavery; the high number of Northern white working class votes for Horatio Seymour in 1868; and the general prevailing racial attitudes toward Black people in the North and West. Was the motivation based more on economic factors from a "free soil" perspective to end competition from enslaved labor, or were they actually motivated by moral reasons to end slavery?
/u/JohnBrownReloaded provides an answer to the question of Union soldiers' motivations [here] (https://www.reddit.com/r/AskHistorians/comments/ofk870/to_what_extent_did_average_union_soldiers_realize/). You are right to be skeptical of the claim that most Union soldiers were motivated by wanting to end slavery, especially since the war was framed pre-Emancipation Proclamation as being fought to preserve the Union and not to end slavery (of course there were even pro-Union slaveholders in the border states). There were many reasons why a Union soldier would be motivated to fight, including but not limited to abolishing slavery.