This process of dishonorably discharging a soldier had its origins in the British army in the 17th century and was later picked up by the American military. Soldiers could be drummed out for a variety of reasons, from thievery to desertion.
Usually, during a drumming out, the guilty man’s head was shaved, the insignia and buttons taken from his uniform, and a sign detailing his crime hung around his neck. Sometimes he was dressed in felon’s clothes or white feathers were placed above his ears, and other times a rope was put around his neck and he would be led by the smallest drummer boy. The convict would then be marched between the lines of his fellow soldiers to the tune of “Rogue’s March,” and he would be taken to the entrance of the camp, where he was sent on his way with orders to never return.
“Rogue’s March” was often played by drums and fifes, though if they couldn’t be found, a trumpet was sometimes substituted and the process was called being “blown out” of the army. During the Civil War, “Yankee Doodle” was sometimes played instead of “Rogue’s March.”
The point of drumming out a soldier was to make his departure from the military humiliating enough that others would be discouraged from committing the same crime. So in addition to being drummed out, the local newspaper would sometimes write about the man’s crime to make it public. However, drumming out eventually fell out of favor as a punishment, and by World War II it had largely been dropped altogether in the U.S.