The history of muslims who emigrated to the U.S. is convoluted. The earliest documented Muslim was Estevancio, a North African captive who became a famous Spanish explorer. It is estimated that 1.2 million slaves transported to America were muslims. Before the Civil War the Naturalization Act of 1790 stipulated that only white men of good character could become naturalized citizens. The wave of bigotry called nativism in the 1830's also discouraged emigration by dark skinned people from regions where Muslims were living. It wasn't until the 1870's when emigrants from Syria, Jordan, Palestine & Lebanon were classified as "Turks" that an appreciable number of people of the Muslim faith emigrated. With the disintegration of the Ottoman Empire, the frist full scale emigration of Muslims began in 1920. It was the congregation in Cedar Rapids, Iowa in 1934 that opened what is considered the Mother Mosque of the U.S. Muslim community. The oldest mosque still standing in the U.S. is in North Dakota, near the Canadian border.
This chronology makes clear that like the lone pigtailed Chinese soldier in the Army of the Potomac, there would have been a few Civil War soldiers of the Muslim faith, but they would have been few & far between.