As in most wars, both sides like to believe God is on their side. This was certainly true during the American Civil War. Abraham Lincoln and Jefferson Davis, as well as generals of both armies were convinced God approved their respective causes.
It seems both sides in the Civil War used religion for their own purposes. Northerners used Chritianity as a calling to eradicate social ills, while Southerners focused on a literal reading of the Bible, but ignored social problems.
During mid-19th century America, people as a whole were devout, and religious institutions brought people together on a regular basis. Almost every person believed in a Divine being. Not believing in God was thought to be an aberration. "The Second Great Awakening of the early 19th century in particular greatly impacted American society." http://www.brucegourley.com/civilwar/gourleyhistor1.htm
". . . no other antebellum group had as much power to influence the greatest number of citizens on a regular basis as did America's clerical religious leaders." Robert. J. Miller/The Citizens' Companion/October, 2007
But what was the prevailing religion of this time period? The country was originally founded by Protestant fundamentalists, but the 19th century saw a great influx of immigrants bringing their customs and religious beliefs with them.
Civil War armies were said to be "the most religious armies of all American history." The Citizens' Companion/October, 2007
But the major religions represented were Calvanist-based Protestants.
Mid-19th century America was rampantly anti-Catholic, born of fear of immigrants from Catholic countries. But the Irish emigration of the 18th and 19th centuries slowly began to transfer the face of American religion and it had a major impact during the Civil War. "The Civil War for the first time witnessed large numbers of Roman Catholic chaplains in the field . . ." http://www.usachcs.army.mil/history/brief/chapter_3.htm.
Although primarily serving in the Union armies, as depicted in the movie Gettysburg when a priest gives the Irish Brigade a mass benediction before going out into battle, Roman Catholic priests also served in the Confederate Army as chaplains, although to a lesser degree. " . . . historians are only slowly recognizing the contributions of Catholics and minority religions in relation to the Civil War." http://www.brucegourley.com/civilwar/gourleyhistor1.htm
Southern leaders, including Jefferson Davis, held a low opinion of clergy in the service. They valued fighting men over praying chaplains. They also believed in the strict separation of church and state.
But, it seems both sides took what religious teachings they could use to justify their cause.
Sources: Miller, Robert J. 'The Citizens' Companion'. October, 2007. Vol. XIV - No. 4. pps. 11-15.