As mentioned by BCdotWeb, the song is a well known gospel/folk song "The Poor Wayfaring Stranger" which talks about the difficulty of life and the hope of a heaven beyond. The lyrics would be very appropriate for anyone looking death in the face, especially during a battle where one is on the front line, as was the case of the men in the movie. They were minutes away from charging into almost certain death.
Here are the full lyrics as sung by Johnny Cash (note there are different variations but the message is essentially the same).
I'm just a poor wayfaring stranger
Traveling through this world below
The first lines reference the singer of the verse. The poor wayfaring stranger traveling through this world.
There is no sickness, no toil, nor danger
In that bright land to which I go
The stranger is bound for a land with no sickness toil or danger, the opposite of the world he is wandering through now.
I'm going there to see my Father
And all my loved ones who've gone on
He is going to meet his family who have already passed through this world
I'm just going over Jordan
I'm just going over home
"Going over Jordan" is most likely a reference to the House of Israel in the Bible crossing the river Jordan to claim the Promised Land as their Home. In this case, the promised land is a metaphor for heaven.
I know dark clouds will gather 'round me
I know my way is hard and steep
But beauteous fields arise before me
Where God's redeemed, their vigils keep
I'm going there to see my Mother
She said she'd meet me when I come
So, I'm just going over Jordan
I'm just going over home
I'm just going over Jordan
I'm just going over home
This world is dark and difficult, but its bearable because of the hope of returning to that peaceful land with beauteous fields and where Mother waits for him, in the promised land over Jordan.