There has been no in-universe explanation as to why the Marines wear the coats over their shoulders.
The only in-universe information regarding those coats is that they are supposedly held up by the Marine officers' beliefs in Justice. As long as the Marine in question believes in the justice of the Marines or World Government, the coat will not fall! ... is what Oda said in SBS Volume 61, Chapter 596
Reader: You know the coat that all those commissioned Marine officers wear on their backs? The one that says "Justice". That thing never falls of no matter how much the guy wearing it moves, but how does it stay on? A snap stopper? Or maybe super glue? My husband says "it's rubber" (making it a circle and passing it through another circle). P.N. Koteni-
Oda: Too bad, nothing is on there. That is a coat that has "Justice" on the back. It never falls off, because to them, Justice never "falls"!! As long as that feeling stays in their hearts, THE COAT WILL NEVER FALL!!!
The out-universe explanation is described by the TV trope CoatCape linked in the comment by mivilar. It states that military leaders (and delinquents aka pirates) often wear their coat as a cape to show how cool the character is. The coat will never fall off despite the situation. The Trope also explains not to confuse the (Marines') Coat-Cape with (Mihawk's) Badass-Longcoat or the Coat-over-the-shoulder.
Sometimes, to show how cool a character is (or just how broad his shoulders are), all he has to do is wear his coat like a cape, as in not bothering to put his arms through the sleeves. This is often a trait of Japanese Delinquents or military leaders.
Don't expect them to slip or fall off, even up against powerful winds, explosions and any amount of running, jumping and acrobatics, unless it's for dramatic reasons.
Compare Coat Over the Shoulder. Not to be confused with Badass Longcoat, which often resembles a cape but is worn normally.