The Old Swiss Confederacy (1291 - 1515) was so loose a federation of autonomous regions, that Switzerland had no common field sign nor uniforms, not even a common high commander during most of its history. When swiss troops went to war (and they did so quite often back in late middle ages), they carried the flags of their region with them.
Nevertheless, the characteristic white cross and the red background of Switzerland's flag have their origin in late middle ages. Until 1648, Switzerland was still part of the German Empire. The member states of the Old Swiss Confederacy did not try to build a nation, they just wanted to get rid of the counts of Habsburg that had tried to strengthen their influence. In the 13th century, the German emperor carried with him a flag with the cross as a holy sign, understanding himself as a protector of christianity. Besides, he also carried a blood-red flag as a sign of his power over life and death. Occasionally, he granted the right to carry such flags as a special honor to single cities or regions. (The Dukes of Savoy and the City of Vienna bear a white cross on red ground on their coat of arms. The Scandinavian countries and Great Britain as well have a cross on their flags.) Often the right to bear a cross on one's coat of arms and on a flag was granted together with other privileges, like direct immediacy [direct subordination under the emperor's jurisdiction without jurisdiction of counts].
The region of Schwyz in central Switzerland, one of the three founding members of the Old Swiss Confederacy, and the one, whose name was later in history used to denote the confederacy as a whole, was granted immediacy in 1240 and carried a red flag from the middle of the 13th century on (yet still without the white cross). In 1289 they supported King Rudolf of Habsburg in a war against Burgundy and received as a recognition the right to represent the crucifixion of Christ and the tools used to torture him in the upper right field on their flag. Originally they painted this symbol on parchment and fastened it on the banner. Only later the cross symbol was painted directly on the banner.
The larger the old confederacy became, the more they had a problem with inconsistently clothed troops that were hardly able to recognize their allies on the battlefield. In descriptions of the battle of Laupen (1339), white stripes forming crosses are mentioned for the first time as a joint recognition sign of confederate troops. The white stripes were fastened on the soldier's breast, back, shoulders, arms, leg, hats or weapons. In the middle of the 15th century, the white cross was integrated into the flags of the member states of the confederacy. Originally, the cross reached to the edge of the banner also in Switzerland, like in the scandinavian flags.