War dogs were used by the Egyptians, Greeks, Persians, Sarmatians, Alans, Slavs, Britons, and the Romans. The Molossian 'Canis Molossus' dog of Epirus was the strongest known to the Romans, and was specifically trained for battle. Among the Greeks and Romans, dogs served most often as sentries or patrols, though they were sometimes taken into battle. The earliest use of war dogs in a battle recorded in classical sources was by Alyattes of Lydia against the Cimmerians around 600 BC. The Lydian dogs killed some invaders and routed others.
Often war dogs would be sent into battle with large protective spiked metal collars and coats of mail armor. Native Americans also used dogs as pack animals and to pull travois.
During the Late Antiquity, Attila the Hun used giant Molosser dogs in his campaigns. Gifts of war dog breeding stock between European royalty were seen as suitable tokens for exchange throughout the Middle Ages. Other civilizations used armored dogs to defend caravans or attack enemies. The Spanish conquistadors used armoured dogs that had been trained to kill and disembowel natives.
Later on, Frederick the Great used dogs as messengers during the Seven Years' War with Russia. Napoleon also used dogs during his campaigns. Dogs were used up until 1770 to guard naval installations in France.
The first official use of dogs for military purposes in the United States was during the Seminole Wars. The American Pit Bull Terrier was used in the American Civil War to protect, send messages, and as mascots in American World War I propaganda and recruiting posters.
The use of dogs in warfare have been used by many civilizations. As warfare has progressed, their purposes have changed greatly.
Mid-7th century BC: In the war waged by the Ephesians against Magnesia on the Maeander, the Magnesian horsemen were each accompanied by a war dog and a spear-bearing attendant. The dogs were released first and broke the enemy ranks, followed by an assault of spears, then a cavalry charge. An epitaph records the burial of a Magnesian horseman named Hippaemon with his dog Lethargos, his horse, and his spearman.
525 BC: At the Battle of Pelusium, Cambyses II uses a psychological tactic against the Egyptians, arraying dogs and other animals in the front line to effectively take advantage of the Egyptian religious reverence for animals.
490 BC: At the Battle of Marathon, a dog follows his hoplite master into battle against the Persians and is memorialized in a mural.
480 BC: Xerxes I of Persia is accompanied by vast packs of Indian hounds when he invades Greece. They may have served in the military as well as being used for sport or hunting, but their purpose is unrecorded.
231 BC: the Roman consul Marcus Pomponius Matho, leading the Roman legions through the inland of Sardinia, where the inhabitants led guerrilla warfare against the invaders, used "dogs from Italy" to hunt out the natives who tried to hide in the caves. 
120 BC: Bituito, king of the Arvernii, attacked a small force of Romans leaded by the consul Fabius, using just the dogs he had in his army. 
1500s: Mastiffs and other large breeds were used extensively by Spanish conquistadors against native Americans.
1914–1918: Dogs were used by international forces to deliver vital messages. About a million dogs died in action. Sgt Stubby, an American Pit Bull Terrier mix was the most awarded dog of World War I and became the first dog to be given a rank (of Sergeant) when he discovered, captured, and alerted the Allies to the presence of a German spy. Rags was another notable World War I dog.
1941–1945: The Soviet Union used dogs strapped with explosives to destroy invading German tanks.
1943–1945: The United States Marine Corps used dogs, donated by their American owners, in the Pacific theater to help take islands back from Japanese occupying forces. During this period the Doberman Pinscher became the official dog of the USMC; however, all breeds of dogs were eligible to train to be "war dogs of the Pacific". Of the 549 dogs that returned from the war, only 4 could not be returned to civilian life. Many of the dogs went home with their handlers from the war. Chips was the most decorated war dog during World War II.
1966–1973: Approximately 5,000 US war dogs served in the Vietnam War (the US Army did not retain records prior to 1968); about 10,000 US servicemen served as dog-handlers during the war, and the K9 units are estimated to have saved over 10,000 human lives. 232 military working dogs and 295 US servicemen working as dog handlers were killed in action during the war. It is estimated that about 200 Vietnam War dogs survived the war to be assigned at other US bases outside the US. The remaining canines were euthanized or left behind.
2011: United States Navy SEALs used a Belgian Malinois military working dog named Cairo in Operation Neptune Spear, in which Osama bin Laden was killed.