The sad part of course is that they were fighting for a country that was discriminating against them. Now, while the USA didn’t treat African-Americans nearly as badly as Hitler treated Jews, these young men were willing to die for their country, even though a huge chunk of their country was completely built against them. It’s a bit ironic that USA defeated Hitler with a segregated army.
The US Army was segregated during World War II, but the attitudes towards African-Americans in uniform were undergoing change in the minds of some generals, including Eisenhower and Bradley. At parades, church services, in transportation and canteens the races were kept separate. Black troops were often not allowed to fight. They had to drive the trucks and deliver supplies to towns after the allies had liberated them. Curiously enough, this ended up with the townsfolk having more of an appreciation for the blacks than the white because they gave them food, shoes, etc.
As one might expect they struggled with the war itself and how their fellow soldiers treated them. When they went to Germany however, they were actually accepted more there than in America. There was lots of footage of them dancing and partying with white German girls. Some wrote letters describing their treatment by the Germans as better than how people treated them in America. Some even wrote about how they wish Hitler had won the war. They found it hard to return after getting the taste of equality. Some of the early civil rights leaders and prominent figures were veterans of WW2 and historians point out that the soldier’s experiences overseas set the stage for the civil rights movement.
Due to the segregation and reducing of most black soldiers to non combat roles, they constituted well under 1% of US military deaths during WW2. But even so, in WW2 the black units were highly decorated. In addition to actual bravery, the US commanding officers often put these “more expendable” units in more dangerous areas. Racist officers didn’t care whether they lived or died. In 1948 the military ended segregation in the army by order of President Truman. Korea was the first war black Americans fought in the same units as whites did.