I am having sharp pain in the right back. Can this be because of pregnancy?

Yes. Pregnancy can cause back pain due to the increased weight/mass in the front part of the body placing more strain on the stabilizing back muscles. However, obviously pregnancy isn't the only thing that can cause back pain.