A few ways:
-If you keep your dragons' energy above I think 80% for at least 3 days straight, you'll get one gem every day
-You can sell things for gems in the auction house
-Players can trade/gift them to you in the crossroads
-And, of course, you can buy them... but you really don't have to!