Years ago, I had the same problem with my lower right back. It turned out to be related to my mattress. I cannot say this is the case for you.
If the problem persists, I would recommend having your PCP/Family Physician assess you.
I'm not sure if it would or not but is it possible you could have a kidney infection?
Memory foam is polyurethane with additional chemicals increasing its viscosity and density. It is often referred to as visco-elastic polyurethane foam. In some formulations, it is firmer when cooler. Higher density memory foam reacts to body heat, allowing it to mold to a warm human body in a few minutes. A lower density memory foam is pressure-sensitive and moulds quickly to the shape of the body.
So you can use it but not for a longer period of time.