Federal military doctors would wear a Federal officers uniform conforming to the regulations of the time when possible. The same would hold true for Confederate medical officers... clothing that would reflect their organization's regulations when possible. These would not be civilians.
Protective clothing:
White or even unbleached cotton or linen clothing was used for all kinds of protective clothing during the eighteenth and nineteenth centuries. This could include farm smocks, hunting shirts, work jackets and tradesman's aprons. This is for a simple and practical reason...it can be easily washed, and bleached if needed. Remember that this is the period before wool garments could easily be cleaned. Summer weight clothing was often white too.
Many surviving black wool frock coats and civilian sack coats were not originally made as black garments, but were over-dyed to mask staining to extend the life of the garment. Men wear stuff out and then throw it away... women generally do not if their socioeconomic status allows replacement or up to date fashions.
As far as black clothing goes in period art, The color pallet for mens clothing was already pretty limited by radical fashion changes during the Regency period. Many professionals in formal attire were depicted in black frock coats and dark trousers.
We still wear some combination of Dark Blue, Black, Gray, or Brown upper clothing and White, Tan, Gray, Dark Blue or Black trousers to this day as a result.
Hope this helps,
Ken