19th century draft of the seal of Duke Frederick II
The flag traces back to the coat of arms of the medieval Babenberg dynasty, a silver band on a red field (in heraldry: Gules a fess Argent). The origin of the Bindenschild has not been conclusively established, it possibly derived from the Styrian margraves of the Otakar noble family, who themselves may have adopted the colours from the descendants of the Carinthian duke Adalbero (ruled 1011–1035), a scion of the House of Eppenstein extinct in 1122. However, already the Babenberg margrave Leopold III of Austria (1095–1136) was depicted with a triband shield in 1105.
Duke Leopold V, kneeling, receives the red-white-red banner by Emperor Henry VI, Babenberger Stammbaum, Klosterneuburg monastery, about 1490
According to legend, the flag was already invented by Duke Leopold V of Austria as a consequence of his fighting during the Siege of Acre. After a fierce battle, his white surcoat was completely drenched in blood. When he removed his belt, the cloth underneath was untouched by it, revealing the combination of red-white-red. So taken was he by this singular sight that he adopted the colors and scheme as his banner. The incident was documented as early as 1260, though it is highly unlikely.
In fact, the war flag of the Holy Roman Empire during the Crusades was a silver cross on a red field quite similar to the later Austrian arms. This ensign was used by the Austrian capital Vienna from the late 13th century onwards.
Beginning in the reign of Emperor Joseph II, the Austrian, later Austro-Hungarian Navy used a Naval Ensign (Marineflagge) based on the red-white-red colours, and augmented with a shield of similar colours. Both of these flags became obsolete with Austria-Hungary's dissolution in 1918, and the newly formed rump state of German Austria adopted the red-white-red triband as its national flag.
The flag of Latvia uses unusual colour (carmine, "Latvian red") and unequal horizontal bands. One version of the origin of the Latvian flag also parallels that of the Austrian flag, it however is folk etymology - the flag is designed after flag described in a 13th-century chronicle, which does not speak of its origins or symbolism.
The flag of Lebanon bears a close resemblance, showing the greencedar in white field. The Lebanese flag has similar upper-down red stripes with Spanish fess. One theory on the flag's design holds that since Lebanese member of parliament Henri Pharaon, who was involved in the making of the flag, was a long-time consul in Vienna and was an avid friend and founder of the "Austro-Lebanese Association of Friendship", the colors could have been inspired by the Austrian flag.
The flag of Peru resembles the colours, but has its bands aligned vertically.
The royal flag of Poland-Lithuania of the 17th century had very similar red-white-red stripes with royal insignia inside.