After watching many documentaries about air plane crashes, it seems that aviation industry learned many of its lessons from disasters. For example, from the 2 mid-air explosion of de Havilland DH 106 Comet in 1950s they learned a lot about metal fatigue that can cause Explosive decompression. So, I'm curious to know how did the industry come to know about the drastic difference in air pressure that occurs in high altitude? Was the knowledge already there before an airplane was even invented?
The entire reason why the Comet broke up in midair is because they pressurized the plane in the first place.
It was known for a long time that air at high altitude was thinner. This can be experimentally verified by taking a barometer up to a mountain. This was first done in 1648 (and subject to hot debate regarding the nature of air) more than 250 years before the Wright brothers first flew.
Aside from mountaineering investigations, the service ceiling of WWII propeller-driven aircraft like the Spitfire was pushed up from about 34,000 feet to 45,000 feet, so the general effect of reduced air pressure on aircraft and engine performance was already known. Of course both civil and military aircraft were unpressurised before the start of jet-powered civil aviation (though there were some experiments with full-body pressurised suits, to avoid damaging the aircrew more than the plane at those altitudes).
I think the significant novelty was discovering the effect of cyclic stresses (a.k.a. "fatigue") in a new situation, namely of the order of 100 to 1000 loading cycles to failure. Before that, the most common design consideration was one loading cycle, where over-stressing caused immediate failure. With a suitably large safety factor and fortuitous choice of materials, that design criterion would also give an "infinite life" for high-cycle fatigue situations like rotating machinery (e.g. piston engines). New materials, plus lower safety factors driven by the need for minimum weight, discovered a new "cliff edge" for designers to "fall off" - and the history of engineering contains many examples of cliff edges being discovered by falling off them.
The range of air pressure from sea level to the maximum ceiling of modern aircraft was known even before the airplane was invented. The difference between the troposphere and stratosphere was discovered by balloon measurements by Teisserenc de Bort in 1902. Most passenger airlines fly in lower levels of the stratosphere. No planes can fly above the stratosphere.