This can happen due to falls, catching feet in wire floors of their cage, or even being stepped on while having their daily roaming time.
It might be difficult for you to assess, especially if it’s of the ribs, skull, or paws, but the treatment will be the same: gently put the rat into its comfy travel cage and get to the vet. Make the journey as smooth-going as possible, as a broken leg or paw can hurt a lot when trying to balance against the force of your car turning sharp corners.
The vet will advise on what to do next. Each incident is different, and appropriate care is needed in each situation.