From ancient times to recent history, this trope has been frequently been the standard for military uniforms, for a number of reasons.
For starters, pride and Executive Meddling by leaders eager to have a fancy-looking army certainly play a part — pleas from commanders that their men cannot walk, let alone fight, while wearing gold shoes be damned. Even for nations with saner leadership, however, military uniforms make an excellent way to prominently display a nation's wealth and industry, and there are examples that even in Real Life, this trope is not bad.
The Romans, for instance, had entirely practical uniforms that still managed to incorporate bling of war in an incredibly intimidating way: imagine being a tribal European standing side by side with your Home Guard armed and armored with family heirlooms and re-purposed farm implements, facing a Legion clad in identical gleaming armor bolstered with tanned leather, trimmed with practical and understated fringes and embossing... and then realizing that these were just their foot soldiers as the guys with the really fancy armor rode up on horseback and started ordering them to march forward in lockstep.
The gear of rich and noble warriors during the Middle Ages and Renaissance — including etched and gilt plate armor, ostrich-plumed helmets, weapons inlaid with gold or silver, and horse trappings of precious fabric — illustrates other benefits. In an age when taxation was inefficient, interest rates were high, and state bankruptcy was common, leaders often ran out of money to pay their soldiers. This was terrible for morale, and contributed to disobedience and desertion. Display was one means by which leaders reassured their jittery constituents: Allies, mercenaries, and troops from your own domains would see you leading troops in all this finery, and reason that if you can afford to lavish money on such conspicuous consumption, you must also be solvent enough to pay them on time. In contrast, a leader wearing shabby-looking equipment might be assumed to be impoverished, unsuccessful, or unreliable. Even if you should exhaust your funds, then you'll still have assets in the form of war bling and other treasures that you can sell or pawn in order to raise more money in the short term. Furthermore, your war bling will advertise to your enemies that you are rich and capable of paying a hefty ransom, so that they will make more of an effort to capture you alive if they happen to get the best of you on the field.
A highly decoratednote commander also tends to bolster his men's confidence, and is easy to locate and rally to in battle. For the average soldier, meanwhile, even small touches like a Cool Helmet and a classy uniform can be a powerful morale booster.
This trope can also be subverted, because what may seem to be Awesome, but Impractical may in fact be both awesome and practical in action. The Winged Hussiars of Poland demonstrate: the large wing-like structures fixed to the back of this legendary cavalry group's armor may seem like impractical Bling of War... until you see modern historical reenactors in action, and realize the terror of being charged by a wall of armor-clad bird-angel-centaur-screaming-nightmare-things that you can't attack from behind.
Brightly colored and flashy uniforms continued to be the rule rather than the exception well into the age of guns and cannons, precisely because of the limitations of early firearms. Smoothbore weapons firing round balls were very inaccurate, especially when using undersized balls. Troops had to line up in the open and fire huge volleys at the enemy if they hoped to hit anything, and the clouds of smoke produced by burning black powder greatly reduced visibility on the battlefield. Rifled guns using tightly fitted balls were more accurate, but they became increasingly difficult to load as the barrel became fouled with powder residue, and their increased range and accuracy was negated when they couldn't even see the enemy through all the smoke. Thus, rifles were only normally used by specialized sharpshooters and skirmishers until the mid-19th century brought technological improvements that made mass-equipping armies with rifles feasible. Such sharpshooters did sometimes manage to pick off the commanders, but it still wasn't enough to make them lose the bling. In the confusion of battle, it was much more important to be able to be able to identify in an instant which officer was in charge of the situation, or whether the men approaching you through the fog were friend or foe. The tendency was to shoot anybody you didn't recognize, so the uniforms were important for preventing friendly fire.
Changes in the technology of warfare eventually made these fancy uniforms obsolete, as the danger of being spotted by the enemy began to outweigh the benefits. In modern uniforms, this trope tends to be heavily downplayed or entirely averted in the field, bling being a good way to show snipers who to shoot. Modern field insignias and distinctive signs have muted colors and small size, typically a small patch painted grey on a black background on the uniform's collar.
In ceremonial circumstances, however, Bling of War continues to be in full effect in many nations: uniform regulations are serious business, and you will wear your Chest of Medals whether you like it or not. This is largely because sharp-looking uniforms are a good public relations and recruiting tool; to the general public the military appears organized and professional, and to potential recruits they look successful and attractive. This, and the tradition behind the uniforms is important for morale and espirit de corps.