Hi, Pianojems.
Everything said so far is good and helpful in a general way. The Alexander technique is good and so are sit-ups (more for lower back though).
Now here is what is specifically causing your pain:
The small muscles in the middle of your upper back (not very strong) are carrying the weight of your arms, either because you are sitting too far from the piano, or because you are hunching your shoulders (rolling them forward). Or both.
Solutions to try:
1. Sit with your back straight and upright. Now roll your shoulders back and let your arms hang from the arm socket. This is very natural and does not strain any muscle. If you now let your shoulders drop forward, so that your arms are no more hanging from the shoulder socket, you will feel what I am talking about, and how the upper back muscles have to strain to support the arms. Roll you shoulders back again, and without moving on the shoulder area, lift your forearms using the biceps (the muscle at the front of the upper arm). The feeling is that of a string puppet, with strings tied to the wrists. This should bring your hands to the level of the keys. Now in order to bring your hands to the keys, you must combine two movements: move the elbows forward and lean from the hips – keeping the back straight – but no longer upright, since you are leaning forward. Depending on your distance to the piano, these movements should be relatively small. In fact the leaning should be so small that your arms should still be hanging from the shoulder sockets. Adjust the distance to the piano by reference to the distance of the elbows from your body. The elbows should be no more than a fist away from your body. But no less than clear from the body, so that if you had to move the arms in front of you, the elbows would just be clear from the body. The whole idea is to use the lower body (leaning from the hips, moving the elbows forward) to get to the piano, rather than the shoulder (I know, I know what about all those instructions to play with the shoulder? It is still possible, but not by letting the arms be supported by the back – you will have to experiment and learn how to do it, or get someone knowledgeable about all this to show you).
I hope this is not too obscure. It is easy to demonstrate, difficult to write about it, and even more difficult to figure out what to do from what someone wrote.
2. If in pain during practice, stop, lie on the bench belly up. Position yourself on the bench so that the painful bit is right at the edge of the bench. Bring your arms above your head (do this near a wall, so your hands can support the weight of your body on the wall) and do a nice back stretch. Roll back and forth massaging the painful spot on the bench. You should feel no pain when stretching (my moto: no pain, no pain!

), just a nice elongation of the muscles. This should alleviate the pain immediately and buy you another 15 – 20 minutes of practice. But you still will have to sort it out since this is only temporary relief.
3. Investigate this pain. Observe it. Move around, see what makes it better, what makes it worse. Use one of these chairs that you partly kneel down on them and force you to keep your back straight (they have a big drawback, though, you will not be able to use the pedals – but they are all right for practice you do not use the pedal).
4. Alexander technique and sit ups are good, but there is other stuff as well. Yoga works miracles. Have you ever heard of the Feldenkrais method? Pianist Alan Fraser wrote a very interesting book applying Feldenkrais to piano playing. (The craft of playing the piano). Check out his website:
https://alanfraser.faithweb.com/title.htm5. Get the video “Freeing the caged Bird” by pianist Barbara Lister-Sink, which shows how to apply Alexander to piano playing.
And let us not forget Tai Chi, which is excellent for posture.
Finally this may also be due simply to stress and tension.
I hope this helps. (And yes, I have been there too!)
Best wishes,
Bernhard.