Denzel Washington's character violates orders and Colonel Shaw, played by Matthew Broderick, is forced to have him whipped... in front of the whole regiment.
More so because when Pvt. Trip's shirt is ripped off, it's revealed his back is already a mess of scars from having been whipped as a slave. The Drill Sergeant Nasty that is supposed to administer the looks at Shaw with a shocked expression that shows even he, who has been insulting the recruits greatly, doesn't want to do this, but is forced to. Shaw watches every moment, trying to keep a professional face but obviously hurting. Trip staring Shaw down, not making a sound as he's whipped doesn't make it any easier.
And then there's the Colonel's death in battle. And Trip picking up the flag for the first time. And the regiment seemingly being so close to victory but being slaughtered. And finally, the sad music playing as all the bodies, black and white, are set into the pit together.
After Col. Shaw's parents were informed of his death, the Confedarate in charge having wrote them that Shaw had been buried in a communal grave with "the negroes that fell with him," meaning it as an insult. Some efforts were made to recover the Colonel's body. His parents spoke out against it; his father Frank Shaw wrote a letter later saying "We would not have his body removed from where it lies surrounded by his brave and devoted soldiers....We can imagine no holier place than that in which he lies, among his brave and devoted followers, nor wish for him better company – what a body-guard he has!"
Or even better, when the regiment is still in training, they receive news that the Confederate Army had declared that any black man found in uniform will be hanged, as will any white man found in command-there'll be no prisoners. Colonel Shaw says the Union Army will allow a discharge for anyone who wants it. The next morning he asks his friend, "How many are left?" When he doesn't answer, the camera pulls back to show that NOT ONE black or white soldier has left. A choked up Shaw can only say "Glory Hallelujah." Damn straight.