It is certainly possible that your new mattress is contributing to this new back pain that you have developed. It turns out that individual people respond quite differently to different types of mattresses. For example, you mention that a soft mattress may cause back pain, and this is certainly the case for some people, where the lack of firm support causes sagging of the back and strain on the back muscles. For some other people, however, a very firm mattress may cause pressure over bony prominences on the back and hips, leading to discomfort.
You should discuss this issue with your primary care doctor
, who can help you determine if there is any evidence of a back problem, such as a muscle spasm or strain. If so, they can recommend medications to relieve the pain and also suggest some back exercises that might help to relieve the symptoms.
It may also be that your back pain is unrelated to your mattress. For example, if you have recently changed jobs and are now sitting at a computer all day long, or are lifting heavy objects, then these might be the cause of your discomfort. These are also things you can talk with your primary care doctor about. Good luck!