Most likely the soldier made his decision to take the Oath of Allegience. Home Guard units were actively trying to locate deserters, but if caught, he would have either been returned to his command for court martial, or the Home Guard, would have simply hanged or shot him.
Confederate POWs were given the opportunity to take the Oath of Allgience and to remain north of the Ohio River, or also to enlist in the US Army (for service against the indians out west) and a few enlisted in the US Navy.