Since the founding of the US, there were some who felt that Slavery as an idea was evil. The tough part seemed to be developing a pragmatic political philosohpy around this.
In the mid 1800's one of the political currents that started to flow around the northern states was that slavery was not just morally wrong, but that it actually hurt free white people economically and socially by depressing the labor market and making entire industries off limits to free whites.
When you follow this thinking, USA territorial aquisitions become a bit of a problem. You certianly don't want the evil to spread, but if you just let the "Free Market" take its course, slaveholders will naturally gobble up most of the land for plantations. They have more money to start with, and can potentially earn much more off of it than free men could, as their labor costs are much cheaper.
So it became important to a lot of northern anti-slavery types that new land was not simply sold to the highest bidder, but instead poor whites who wanted to farm themselves were given first crack at it. This was the germ of the idea of simply giving away a single smallish plot of new land to whoever asked, or selling it at a very nominal fee. It was hoped this would stop the spread of slavery.
In 1848 the anti-slavery portions of both major parties left in disgust over the failure of their respective parties to prohibit slavery in the new territories. This was a blow the Democrats could absorb, as their base was in the South anyway, but it killed the Whig party. The new Free Soil party this created had the Homestead Act as part of its platform. After a couple of election cycles, this party merged with the Republican Party.
The Homestead Act was in fact one of the centerpiece ideas of the Republican Party when they were campaigning for the election of 1860. They were not running on the idea of ending slavery, but rather on the idea of stopping its expansion into new states using vehicles like the Homestead Act. So it shouldn't suprise much of anyone that one of the first things they did upon winning the election was pass the Homestead Act.
If there was one single event most reponsisble for this coming to pass, it would probably be the Kansas-Nebraska act, and the ensuing violence. This whole series of events so infuriated northerners that the election of a President with "Free Soil" views became a real possibility. The views themselves though had been floating around for quite a while.