The Government which found no law to pay him except as a non-descript and a contraband, nevertheless found law enough to shoot him as a soldier
Governor John Andrew of Massachusetts (1861-1866)

Background
Equal pay for equal work was a myth for blacks who chose to join the Union Army during the American Civil War. The idea that a soldier has no color other than that of his uniform was hardly official or unofficial policy. With the Emancipation Proclamation in 1863, northern blacks and freed southern slaves were able to join the army (and helped the Union's war effort immeasurably—around 179,000 served during the conflict).

This was not the most popular change in the status quo, as many felt the war was a means to preserve the Union, rather than free the slaves. Prejudice and racism were endemic in many parts of society and the army was no different. Even some of the more progressive types were concerned whether the blacks would fight and if they did, would that be capable.

Many were given the more dangerous or menial roles (and rank) in the service. In a letter to President Abraham Lincoln pleaing for the exercise of the Proclamation, Horace Greeley of the New York Tribune wrote that "we must have scouts, guides, spies, cooks, teamsters, diggers and choppers from the blacks of the South, whether we allow them to fight for us or not." Black soldiers were used for "digging trenches, hauling logs and cannon, loading ammunition, [and] digging wells for white regiments" (both from Zinn). They were afforded little respect and often kept segregated from other units.

Pay was also much smaller. In some cases, white privates received $13 a month and black privates $10 (sometimes even less). Such discrepancies led to protests and in June 1864, Congress passed the Military Appropriations Act to equalize pay. Unfortunately, this came too late for Sgt. William Walker.

"Mutiny"
William Walker served in the Third South Carolina Volunteers, a "colored" infantry unit. Before the unit was put together, he had been a pilot on a gunboat. While on a pass to visit his family (which exempted him from conscription), the idea of enlisting in the army was brought up to him. In his trial, he testified that "I yet, on the promise solemnly made by some who are now officers in my regiment, that I should receive the same pay and allowances as were given to all soldiers in the U. S. Army, voluntarily entered the ranks."

Conditions the men were under were harsh and, in Walker's words:

...the treatment that has been given to the men of the 3d Reg't S.C. Vols. by a large majority of their officers, nine-tenths of those now in service there will be my witness that it has been tyrannical in the extreme, and totally beneath that standard of gentlemanly conduct which we were taught to believe as pertaining to officers wearing the uniform of a government that had declared a "freedom to all" as one of the cardinal points of its policy

If conditions weren't bad enough, they were then informed that the pay would be only $7 a month.

In November 1863, fed up with the treatment, disrespect, and inequality in pay, he and fellow soldiers to go to the tent of Colonel Augustus Bennett, put down and stacked their arms and " accoutrements." He then declared that they "would not do duty any longer for 7 dollars per month." He and the men refused to return to duty until they received equal pay. While his influence is without doubt—he admitted to as much—at no time was he "in charge" or in command of the men. They acted under their own volition and when ordered to pick up their arms and return to duty, it was their own decision to continue refusal. Walker was arrested and demoted to private.

The Trial
That was not the end of the matter. The following January, he was charged and tried in a military court under charges relating to inciting a mutiny, failing to report a mutiny, and insubordination. There were a total of twelve charges and specification of charges, to which he pled "not guilty." The most serious of the charges related to the alleged "mutiny." According to the Articles of War (Article 7), "Any officer or soldier who shall begin, excite, cause, or join in, any mutiny or sedition, in any troop or company in the service of the United States, or in any party, post, detachment, or guard, shall suffer death, or such other punishment as by a court-martial shall be inflicted." Further damning was Article 8, which stated that

Any officer, noncommissioned officer, or soldier, who, being present at any mutiny or sedition, does not use his utmost endeavor to suppress the same, or, coming to the knowledge of any intended mutiny, does not, without delay, give information thereof to his commanding officer, shall be punished by the sentence of a court-martial with death, or otherwise, according to the nature of his offense.

Since it was more or less a foregone conclusion that a mutiny took place (despite attempts to prove he had no command and couldn't be "beginning, exciting, or causing" a mutiny), Walker tried saving the case using the Articles for his defense. According to Article 10,

Every noncommissioned officer or soldier, who shall enlist himself in the service of the United States, shall, at the time of his so enlisting, or within six days afterward, have the Articles for the government of the armies of the United States read to him, and shall, by the officer who enlisted him, or by the commanding officer of the troop or company into which he was enlisted, be taken before the next justice of the peace, or chief magistrate of any city or town corporate, not being an officer of the army," or where recourse cannot be had to the civil magistrate, before the judge advocate, and in his presence shall take the following oath or affirmation:

I, A. B., do solemnly swear, or affirm (as the case may be), that I will hear true allegiance to the United States of America, and that I will serve them honestly and faithfully against all their enemies or opposers whatsoever; and observe and obey the orders of the President of the United States, and the orders of the officers appointed over me, according to the Rules and Articles for the government of the armies of the United States

Which justice, magistrate, or judge advocate is to give to the officer a certificate, signifying that the man enlisted did take the said oath or affirmation.

He pled "ignorant" of military rules and regulations, based on his claim that "never, since the organization of the company, have the 'Articles of War' been read to us nor any part of the 'Regulations' even." He further testified that "we have been allowed to stumble along, taking verbal instructions as to the different parts of our duty, and gaining a knowledge of the services required of us as best we might. In this way many things have occurred that might have been made entirely different had we known the responsibility of our position."

The court disagreed and found him guilty with a vote of 4-2. The charges of mutiny and two counts of disorderly conduct held and the decision was that he should "suffer death" as per the Articles. The case was not reviewed or reconsidered by other authorities and he was placed before a firing squad and executed in front of the entire brigade (that it was to additionally serve as a "warning" seems a fair conclusion).

He was 23 years old.

Aftermath
A result of the execution was the further and strengthened protest for fairness and equal pay that eventually led to the legislation mentioned above. Even Bennett, who had brought the charges, felt that the government should pay the soldiers equally or put them out of the army. The following year (one month prior to the end of the war), the Enrollment Act was passed, which dealt with back-pay owned to black soldiers. Though it was a victory of sorts, as often is the case, it was also a bit backhanded: the "reasoning" involved had little to do with whether the blacks were equal as soldiers, but rather with the government upholding its "contract" with the them.

(Sources: Howard Zinn A People's History of the United States 1980, 1999: twentieth anniversary edition; www.awod.com/gallery/probono/cwchas/walkertr.html, quotes from testimony and related Articles of War from here; www.denix.osd.mil/denix/Public/ES-Programs/Conservation/Legacy/AAME/aame1a.html; www.africana.com/Articles/tt_202.htm; www.lostblacklegion.com/page7.html)