In wartime, the distinction between warships and merchant ships is often blurred. In war, merchant ships are often armed and used as auxiliary warships, such as the Q-ships of the First World War and the armed merchant cruisers of the Second World War. Until the 17th century it was common for merchant ships to be pressed into naval service and not unusual for more than half a fleet to be composed of merchant ships. Until the threat of piracy subsided in the 19th century, it was normal practice to arm larger merchant ships such as galleons. Warships have also often been used as troop carriers or supply ships, such as by the French Navy in the 18th century or the Japanese Navy during the Second World War.
In the time of Mesopotamia, Ancient Persia, Ancient Greece and the Roman Empire, warships were always galleys (such as biremes, triremes and quinqueremes): long, narrow vessels powered by banks of oarsmen and designed to ram and sink enemy vessels, or to engage them bow-first and follow up with boarding parties. The development of catapults in the 4th century BC and the subsequent refinement of this technology enabled the first fleets of artillery-equipped warships by the Hellenistic age. During late antiquity, ramming fell out of use and the galley tactics against other ships used during the Middle Ages until the late 16th century focused on boarding.
Naval artillery was redeveloped in the 14th century, but cannon did not become common at sea until the guns were capable of being reloaded quickly enough to be reused in the same battle. The size of a ship required to carry a large number of cannons made oar-based propulsion impossible, and warships came to rely primarily on sails. The sailing man-of-war emerged during the 16th century.
By the middle of the 17th century, warships were carrying increasing numbers of cannon on their broadsides and tactics evolved to bring each ship's firepower to bear in a line of battle. The man-of-war now evolved into the ship of the line. In the 18th century, the frigate and sloop-of-war – too small to stand in the line of battle – evolved to convoy trade, scout for enemy ships and blockade enemy coasts.
During the 19th century a revolution took place in the means of marine propulsion, naval armament and construction of warships. Marine steam engines were introduced, at first as an auxiliary force, in the second quarter of the 19th century.
The Crimean War gave a great stimulus to the development of guns. The introduction of explosive shells soon led to the introduction of iron, and later steel, armour for the sides and decks of larger warships. The first ironclad warships, the French Gloire and British Warrior, made wooden vessels obsolete. Metal soon entirely replaced wood as the main material for warship construction.
From the 1850s, the sailing ships of the line were replaced by steam-powered battleships, while the sailing frigates were replaced by steam-powered cruisers. The armament of warships also changed with the invention of the rotating barbettes and turrets, which allowed the guns to be aimed independently of the direction of the ship and allowed a smaller number of larger guns to be carried.