All I would add to the above is that in addition to the traditional style that seems to originate with Napoleon there is also the reason, at least in photos as old as the Civil War era, that the picture took sooooooooo long to develop that if you moved your hand around enough it would cause your hand to be a blur on the finished photograph. This is why in some family photos of that era you see all the adults clear because they're standing still for long enough but the kid or kids are blurry because they were moving around and didn't sit still for long enough. So to avoid the finished portrait photo that the soldier probably spent good money on from coming out with a blurry hand (and possibly because some people especially those who are most nervous don't know what to do with their hands sometimes) the soldier unbuttons two or more of his buttons and sticks his hand in it. Keeps the hand still long enough for the photo to turn out well.