That's not how things worked. Up until the summer of 1863 prisoners of both sides were exchanged for equal numbers of officers and men. That way soldiers did not remain in prison for extended periods of time and were returned to military service.
Evidently William J. Beard did not wish to be exchanged and returned to the Confederate army. That's why he took the oath of allegiance to the United States instead of being released on parole like other prisoners. Note that the bond was not signed until many months after he took the oath of allegiance.
My point is, the typical Confederate didn't take the oath of allegiance until the war was over.