It was not just Gettysburg. An enterprising Johnny looking for a battlefield pick-up after Chickamauga found a US 1861 rammed so full of undischarged rounds that he gave up on pulling them, but kept the weapon and discarded the barrel. He used the barrel from another US 1861 (which were parts interchangeable) to create a fully functioning US 1861 which he proudly carried for the rest of the war. He noted (of the find) "...it appears this particular Yankee panicked and was just snapping caps at us." If you have ever fired a black powder musket, believe me you know if it went off or not. Why a soldier did not drop a clogged weapon and pick up another from a fallen comrade is probably best summed above by the word "panic." Battle fatigue, PTSD, panic, whatever you want to call it, this irrational behavior under fire was very real to soldiers of the time and probably was a factor in every battle of every war to some degree throughout history.
It was suspected that the Confederate artist who later painted the famous camp life scene at Corinth named Conrad Wise Chapman was so panicked in his first fight at Shiloh that he intentionally shot himself in the head (see The Confederate Image: Prints of the Lost Cause by Neely and Holzer, p 210). Social mores dictated that such cases be swept under the rug in the mid-19th century, but the evidence of it is not hard to find.