I don't know if generalising this kind of military culture, if there is one, to other countries is true but what I want to know is that why soldiers keep their right hand inside.
That painting is of Napoleon Bonaparte. He is portrayed with a hand-in-waistcoat gesture, common to the portraits of men from the 18th and 19th centuries. That is pretty much the only reason that can be validified. There are many other theories for why Napoleon often hid his hand (including stomach pain, irritated skin, and more), but the only reason that seems to be true is that it was a common pose of the time.
The gesture is usually associated with Napoleon, as seen in these two other paintings of him. However, per the Wikipedia article,
The pose originates from classical times — Aeschines, founder of a rhetoric school, suggested that speaking with an arm outside one's toga was rude.