Today, at least in general parlance, English speakers say the word "ensign" in reference to a rank in the military. This is not incorrect in any way. In the army, an ensign is a junior ranking military officer. Originally, these guys were infantry men and it is from among the ensigns that a man was designated to carry the colors. The seagoing use of the word may be the reason for that.
Originally, ensign was spelled and pronounce ancient and it was simply a ship's flag. Before nations were terribly identity conscious, the ancient was essentially a signal flag. A jolly roger, for instance, could honestly be called an ancient.
All that changed with the primacy of the British Royal Navy. Some time in the late 17th or early 18th century an ancient or ensign came to mean the flag, usually of considerable size, flown at the stern of a commissioned ship to indicate her nationality. These flags, prior to mass production in mills which began in the first quarter of the 19th century, were made by hand and terribly expensive. Flying them was a far less frequent affair than modern cinema would like us to believe. There were only certain times one could technically run up their ensign, and they usually involved engaging an enemy.
Ensigns, in larger navies such as the Royal and French and later the U.S., could also be different colored flags used to designate squadrons of a fleet. A good example in Nelson's Royal Navy would be the blue, white and red squadrons, each with their own Admirals, Rear-Admirals and so on. Nelson, for instance, was a Rear-Admiral of the blue squadron or, as it would have been expressed then, Rear-Admiral of the Blue.
So there you are, Brethren. Fly your ensign with pride. I'll see you tomorrow for Seafaring Sunday.