Could getting hit by a pitch in baseball cause a ruptured muscle?

Very rarely. This would most likely cause a contusion. A larger contusion is often called a hematoma with significant amount of bleeding beneath the skin. Muscles are quite vascular, and if injured, can definitely bleed enough to cause a sizable hematoma. In all of my years of playing & coaching baseball and treating baseball players, i've never seen a muscle rupture from a direct blow by a baseball.
Hit by baseball. Yes. Trauma from being hit by a baseball can cause a ruptured muscle.