Believe it or not, this actually happens quite frequently, even in the wild. This is because staryu and starmie’s jewels are large, often exposed targets and thus the easiest things for other pokémon to strike. So long as the jewel hadn’t completely shattered, starmie should be able to heal itself over time. Until then, you may wish to keep yours off the battlefield. Do not, as some suggest, apply an epoxy to “seal” the wound. This will actually prevent the wound from healing properly and lead to a more brittle gemstone.
As for how to prevent it, there are very few ways to do so because of how much surface area the jewel takes up. However, you may wish to consider teaching your starmie Light Screen or Reflect, or simply rely on Recover to restore damage immediately.