In game King of Thieves there are two ways to get a gem:
1. Steal it from another player
From your dungeon, tap the “Attack” button, and then “Find a Match”. You will then be able to attack a dungeon of a random player.
You can skip the current dungeon by pressing “Skip” button. Note, that each skip costs you some gold. The price depends on your level, but can’t be more than 300 coins per skip.
2. Dig it in the mine
From your dungeon, tap the “Attack” button. On the right side of the screen, there is a map with single player levels. You can unlock mines by playing in single player. Mines are represented by a trolley icon. Each mine will give you a gem once in a while.
However, the gems that could be found in mines are not very valuable (under 5000), so stealing gems is still the most efficient way to increase your rating.