I've mentioned before that James Polk grew a distaste for religious intolerance at a young age when his mother's Episcopalian Preacher refused to baptize him because his father was a Deist. Perhaps that's why he had a special place in his heart for the Church of Jesus Christ of Latter Day Saints (say that three times fast).
The mid 1840's weren't exactly a great example for religious tolerance in America. The recent influx of foreign immigrants, especially Irish to the east coast of the United States had led to the rise of the 'Know Nothing' party which was essentially an organization devoted to keeping Catholics and foreigners out of political office and if possible, out of the country. In addition, 'Anti-Mason' parties would be devoted to fighting the influence of secret organizations on paper, but in practice they often would attack those who were not of a main line Protestant religion.
It's not surprising then that in this time period, a religious movement that supported polygamy and modern day prophets would not be met with understanding. The Mormon Church members were chased out of New York and many other eastern and Midwestern cities and were forced to flee west.
During Polk's time in office, he met with the leader of the church, Brigham Young (yes, the one the college is named after) and decided to allow them to form a 'Mormon Battalion' to head west to California and support the US efforts there in the Mexican War. They didn't see much action, but they made their first steps to creating a home land in the West, far away from the religious persecution they'd faced back east.
The History of the United States is interesting in that the intolerance faced by minorities was really no more or less than anywhere else in the world, however, the sheer size of the expanding country constantly allowed those who were persecuted to move elsewhere and start their own enclaves. When else in the History of the World have you seen anything like Utah, a state founded as a homeland for persecuted minorities within a country?