For as long as there have been super heroes, there have been the colorful costumes that they would wear.
The idea behind uniforms date back millennium by the military which use them to quickly identify their soldiers and have since become part of modern day culture. Uniforms are used to clearly mark and identify police officers, paramedics, specially trained technical specialists or employees. It was not a great leap that superheroes took to wearing them as well to mark themselves on the battlefield and to make themselves distinctive on the comic book pages.
Costumes are often used in folklore to stereotype creatures, like vampires and witches and are a symbol of theatricality, which goes above reality and normality, they show the world that the wearer is willing to stand out from the crowd. The original use of the superhero costume was utilized by Don Diego De La Vega, better known as Zorro who wore a mask to not only conceal his identity to protect his family and loved ones as part of the Secret Identity concept but to inspire the people.
This is a common theme of the superhero costume according to Frank Miller's "The Dark Knight Strikes Again", inspired Bruce Wayne to use the guise of a dark figure to strike fear into criminals and villains. Other costumes served different purposes such as the use of a symbol and for more practical purposes such as Superman's costume.
According to the Golden Age version of Superman, his first suit was made from the blankets and clothing an infant Kal-EL brought in a rocket ship from Krypton. which combined both practicality to withstand the wear and tear of battle unlike conventional clothing but as an intangible link between Kal-El and his life as Superman defending the people of his adopted planet and his original lost homeworld of Krypton.
Over the decades however, superhero costumes have become more varied with a number of them having nothing to do towards concealing their identity but are a direct source of their unique powers or abilities such as Tony Stark's Iron Man suits, Doctor Doom's armor, or Hawkman and Hawkwoman's winged harnesses that contianed the Nth Metal anti-gravity metal and the artifical feathered wings that allowed them to manuever in the air.
While a number of superheroes rarely alter their uniforms or costumes to any great degree, in a number of cases whenever a character undergoes a major lifestyle change, they will often change their costume as well is another concept known as the Costume Change.