Say you have a Tennessee cavalryman on the frontier, he leaves to fight for the confederacy. war ends, could he rejoin after to fight the Indians?
Many confederate soldiers who were captured during the American Civil War ended up fighting for the United States before the conflict between the CSA and USA had even concluded.
Dubbed 'Galvanized Yankees', these were men whom the Union army captured in battle and, after transfer to prison camps, were given the option of pledging new allegiance to the United States in order to serve in frontier regiments against the various First Nations tribes of the Great Plains. The first instance of this type of prisoner recruitment took place at Camp Douglas in Illinois, and one of the initial 228 recruits to join up was an Englishman who'd ended up fighting for the South under the name Henry Morton Stanley - you know, 'Doctor Livingston, I presume' - and had been captured during the Battle of Shiloh.
Especially following conflicts such as the Dakota War, between Eastern Siouxian nations and white settlers in Minnesota, and with US Army resources already heavily invested in fighting the South, there was real need for more men to serve in the US Army. And to many Confederate prisoners - some of whom have been recorded as being of dubious allegiance to the CSA in the first place due to conscription - serving in the largely unknown American West against the First Nations was preferable to languishing in a prison camp.
In the end, these re-committed soldiers ended up comprising parts 12 different units in the US Army. Compared to the action many of them saw during the Civil War, few saw heavy fighting against the Plains tribes. In 1865, the summer following Sand Creek Massacre, members of the 3rd U.S Volunteer Infantry fought off assaults by a combined force of Lakota, Arapaho and Cheyenne warriors at Platte Bridge Station, suffering upwards of 40 serious casualties. Just two days later, some companies from the 1st U.S Volunteer Infantry faced an attack of Cheyenne and Lakota warriors at Fort Rice. But many of the men - a good many of whom were foreign-born and still experiencing varying levels of culture shock from their arrival in the United States during such a tumultuous time - experienced wearying boredom and some, alcoholism. Ken Burns' "The West" spends some time discussing the lives of these soldiers on the frontier.
Interestingly, there were also some 'Yankee' soldiers who ended up fighting for the Confederacy after the Confederate Secretary of War consented to the practice in September of 1864. CSA General Braxton Bragg had been inquiring about potentially recruiting foreign-born, captured Union soldiers into Confederate ranks. A good many had been drafted into service by the U.S Army, and preferred serving the CSA to languishing in such horrible prison camps as Andersonville in Georgia. In one particular instance of this - the 10th Tennessee (CSA) Infantry was authorized to augment its battle-depleted ranks with Irish-born Union prisoners. When few such men wanted to sign up, the regiment ended up recruiting upwards of 250 former Union soldiers of many backgrounds, to its cause. There's actually a novel for young adults called 'Red Cap' which gives a fictionalized account of this particular example of the other Galvanized Yankees.
To learn more about these men, you could read 'The Galvanized Yankees' by Dee Brown (of Bury my heart at Wounded Knee fame) or check out this LINK