Foot drill
Drill in antiquity: Vegetius composed his treatise on the Roman Empire's military, De Re Militari, at some point between 378 and 390 CE during the reign of Valentinian II in the Western Roman Empire. This work consists of three separate, yet related books, the first establishing methods of training and selecting new recruits, the second and third books a continuation of the first, describing in detail training and discipline matters as they pertained not only to the troops, but also to the leadership in times of training and battle, as well as positing an argument for reforms in the army.
Within these books can be found a detailed guide for drill of the army. Among these drills, the military step describes how initial training should consist of "constant practice of marching quick and together. Nor is anything of more consequence either on the march or in the line than that they should keep their ranks with the greatest exactness. For troops who march in an irregular and disorderly manner are always in great danger of being defeated. They should march with the common military step twenty miles in five summer-hours, and with the full step, which is quicker, twenty-four miles in the same number of hours. If they exceed this pace, they no longer march but run, and no certain rate can be assigned."

History of drill: Drill became less common after the fall of the Western Roman Empire and the resultant disappearance of professional armies from Western Europe. In the Middle Ages the individualist nature of Knightly combat, focusing on individual skills and heroism, coupled with the ad-hoc nature of the supporting levies meant that there was no place for mass subordination of troops through Drill. The rise of the mercenary during the renaissance led to some level of military professionalisation: this led to co-ordinated and practiced military units such as the Swiss mercenaries but standardisation was still lacking.
The mass use of firearms in the later 16th Century led to the resurgence of what was considered at the time "Roman-Style Drill". This movement was pioneered by Maurice of Nassau. Intended to enable his soldiers to efficiently handle their firearms, it describes forty-two movements from taking up the weapon to firing. As armies became full-time and more professionalised over the course of the 17th Century it became a natural progression for drill to expand its remit from weapons handling to the manoeuvre and forming of bodies of troops. The most notable figure of the early 17th Century was Gustavus Adolphus, who fielded one of the largest standing armies of the Thirty Years' War before his death in battle.
What would today be known strictly as foot drill emerged over the course of the 17th Century. This period is known as the Pike and Shot period, where muskets and arquebus without bayonets were defended from infantry and cavalry by blocks of pikemen. The requirement for quick and accurate movement of these large bodies of troops in order to outmanoeuvre their opponents on the tactical level led to the introduction of standardised movements and commands. These were the first versions of foot drill, intended to allow a group of disparate individuals to form one organised body of men, moving singlemindedly with united purpose. Additionally, in the confusion of battle it was found that the clear and concise nature of drill commands allowed the individual soldier to cope with the psychological stresses of battle. The apogee of this style of warfare is arguably the English Civil War, as the last major war using these methods before the introduction of the bayonet created "The Queen of Battles": the Line Infantry.
Line infantry won or lost on the rigidity of their foot drill. In the later 17th century that drill evolved into a tool for the complete subordination of the individual. The Prussians demanded automatonic levels of drill competence. Constant and heavy drilling would change a man from a civilian to a soldier, obedient to commands reflexively. This instituted both discipline and subordination. In a period when private soldiers were recruited from what was considered the basest social class, it was considered particularly important to "break the man" into service. For all this harshness, desertion remained commonplace.
In battle, drill was a force multiplier. With the muskets of the era having short ranges owing to the nature of their ammunition and  the reluctance of men to kill one another at short range, it was necessary for battalions to form up as broad lines 2 to 4 ranks deep at distances averaging 25 yards (approx 20 m). In such conditions, particularly when one considers the nightmarish nature of the ubiquitous cannonade and the buildup of smoke from musket discharge, drill allowed the soldier to withdraw into himself and react to commands. There are anecdotal reports of soldiers in this almost trance-like state reaching out to try and catch cannonballs at the end of their arcs, with unpleasant results. The psychological boost which being part of an effectively faceless mass and surrendering one's fate to that of the corporate group provided enabled men to stand in the face of the enemy that bit longer than their foes. As such, the better the drill, the better – in theory – the soldiers. These elements were found to be particularly powerful in colonial theatres by most European states, where massed drill and the discipline that imbued allowed small expeditionary forces to repeatedly defeat larger indigenous forces.
Additionally, greater drill equated to greater manoeuvrability. When troops were thoroughly drilled they could move confidently at speed without their formations – carefully proscribed in order to maximise the use of their weapons – breaking up, particularly over rough ground. When formations broke up precious time would have to be spent reforming them in the face of the enemy: additionally, loose formations breed confusion. The difference between a body of troops and a disorganised crowd is a narrow one. As such, when faced with musketry, cavalry or cannonade a loose formation would be more prone to succumbing to panic and rout. Proficiency in drill further enabled the creativity of generals. Troops who are new to drill are unconfident and tend to panic or become confused when new commands are introduced. Troops who do many drills can more easily be taught new formations, building off the base of experience previously garnered. In a period when all war was foot drill, this could obviously prove an advantage. As an example, the British used an unorthodox two rank line during the later 18th and early-to-mid 19th Centuries as a force multiplier. In the Peninsular Campaign they were able to adapt this formation from strictly linear to a shallow crescent. Coordinating even a minor formation change for roughly 200 men was considered an impressive feat.
Drill was exported to the rest of the world on the back of Colonial victories, with most Imperial nations training local armed forces in European-style drill. One famous example of this trend were the Indian Sepoys of the British Empire.
As weapons gained in range and accuracy, foot drill became less and less important in battle. Advances as formed lines and columns were still attempted - they worked during the Crimean War but were becoming dangerously obsolete by the time of the Franco-Prussian War. The last widespread use of formed infantry in the attack, particularly in columns, was in the first few weeks of the First World War.

Origins of modern drill in the U.S. Military: United States military drill originated in 1778, as part of a training program implemented by Baron Friedrich von Steuben to improve the discipline and organisation of soldiers serving in the Continental Army. The following year Baron von Steuben, by then a Major General and the Inspector General of the Continental Army, wrote the Army's first field manual, "The Regulations for the Order and Discipline of the Troops of the United States", which has come to be more commonly known as the "Blue Book". The methods of drill that von Steuben initiated remained largely unchanged between their inception and the time of the American Civil War. One major change to come about since that time is that troops now march at a cadence of 120 steps per minute, instead of the original 76 steps per minute at the time of the American Revolution.
The stated aim of drill is to "enable a commander or noncommissioned officer to move his unit from one place to another in an orderly manner; to aid in disciplinary training by instilling habits of precision and response to the leader’s orders; and to provide for the development of all soldiers in the practice of commanding troops." 
Between branches of the military, as well as between the military forces of various countries, the methods of drill will vary. In the United States Armed Forces, the basis of drill procedures can be traced to von Steuben's "Blue Book".

Drill in the modern day: Drill today is used as a teaching tool for instilling discipline into new recruits in armies the world over, although style and diligence varies from nation to nation. Some of the most famous drill in the world remains that of the Guards Division.
Drill is most commonly seen at ceremonial and public functions and has evolved into something of an art-form. Many nations have dedicated Drill Teams, although the Guards Division, faithful to the history of Foot Drill, remain full service combat infantry.

References: 

External links: E-text of English translation of De Re Militari
Homepage of De Re Militari: The Society for Medieval Military History, an academic association that is concerned about medieval warfare
An English translation of De Re Militari by  Lieutenant John Clarke (1767)
Army Study Guide.com Pubs and Forms