The correct answer to this open question is the following.
It is well known that President Lincoln did not profess any religion. But later in his life, a couple of personal incidents, such as the deaths of his sons and the beginning of the American Civil War, made Lincoln seriously reflect on the issue of the existence of God.
We can say that the role of religion in Lincoln's understanding of the war was that he questioned if the faith of the Union could be on the hands of a supreme being called god. Historians consider that Lincoln has two main topics to reflect on. If God had a specific purpose to allow the war between people of the same country, and number two, what could be god's idea on the issue of slavery.
The role that religion played in his understanding of the United States more broadly was to consider that there could have been an ulterior motive for the issue of war. He accepted the idea that probably neither side, Confederates, and the Union, could be right. That a moral or religious lesson was part of the war equation that affected and divide the nation.
That is why in one of his speeches, Lincoln mentioned that "A house divided against itself cannot stand," paraphrasing a quote from Jesus of Nazareth. Indeed, the speech was known as "the House Divided speech."