There are many reasons that your back can hurt, but the most important thing to point out is that without more information I can tell you that you need to see your doctor
urgently. More answers to questions may indicate that it is something as simple as a pinched nerve, but there are many simple medical problems that start with something as simple as sudden onset back or shoulder pain, some of which are as serious as a heart attack. For that reason, it is important that you speak to a doctor soon so that they can make sure there is nothing more serious happening right now. Speaking specifically about the symptom of right shoulder and back pain, sometimes pain can be referred from other parts of your body. Problems with your liver or gall bladder can occasionally be passed up to that specific region of your body. If you have a known problem with either of those, that could explain it. Your past medical history is thus very important, as well as the onset and severity of the pain. The key is that you need to speak to your doctor soon to make sure it is not something more serious.