There’s no requirement, and there’s no reason a white person can’t go to a black barbershop, but black people’s hair is often much different to cut than most white people’s hair, and preferred styles quite different.
It’s not so much “this barber is for black people” and more so “this barber is owned by black people, so black people can assume they’ll be given the experience they’re looking for”
Even more so, it’s turned into a hot button topic where people will be actively pissed of at you if you try to bring it up in discussion, calling it a “dog whistle” for nazi / anti-women ideology.