Source: Reddit

First, the spine is not meant to be straight, we have an "S" curve in our spine and a proper, fully supported posture on a seat includes that curve. "Sit up straight" is a long held, incorrect approach to posture. What you should think of is "Don't sit on your tail, but, sit tall" while imagining you have a tail coming out where your tailbone is. Horse riders know what I'm talking about.

Picture from Senter-Merida-Monton Team Monton Sports

That said, we're talking about riding a bicycle, not sitting. When you are riding, you are supporting yourself at four to five points, depending on situation. Two feet, two hands, and your seat. The way you will risk hurting your back with bad posture is if you put yourself in a position where you use your back to lift, yourself or something else, and the leverage is too great. But on a bike you're just holding yourself up, without major sudden movements, and with assistance from multiple limbs. Also, you build strength in the relevant areas over time further reducing chance of injury.

Still, it's hardly a comfortable position and you can develop muscle fatigue over time which is something a training athlete would need to be aware of so that they don't end up with a minor muscle injury that leads them to a more major back injury. And for some people, it's simply not a tolerable position. Those people will not be professional cyclists.

Anthropologically speaking, humans didn't evolve a skeleton for sitting on our asses anyway, we evolved to crouch, which is interestingly very similar to the position held by a cyclist. You see it quite commonly in more primitive tribes, but, not only there. It's so common in some eastern cultures that it has a nickname of "asian squat." Monton Sports

Racing cyclists try to keep their torsos as low as possible for better aerodynamics. At the same time, they have to keep their hips open so they can push the pedals with force (and avoid sitting on their soft parts). That means they have to have a curved back.

Many competitive cyclists do exercises like yoga to develop the strength and flexibility they need to ride like that. They are also naturally tough people who train themselves to ignore discomfort.