Edit: See Page 2 of thread for solutions with 10 squares maximum needed to find gem!
This is an extremely awesome logic problem to figure out! I have figured out a pattern in which you can be guaranteed to find the gem by testing no more than 12 squares. Using the following squares for your first 8 choices, the squares marked with an x are adjacent to one of the first 8 and only 4 squares are not adjacent to one of your first 8 choices (these are denoted by o).
5xoxx6
xxx1xx
x2xxxo
oxxx3x
xx4xxx
7xxox8
Once you find a rock during your first 8 choices, you can just check adjacent squares until you find the gem. By saving the corner squares until last, in this case you would need to check a maximum of 10 squares to find it if you don't find a rock until choice 8.
If you don't find any rocks in the first 8 squares, then you'll just need to check the 4 squares marked with an 'o' in the diagram in order to find the gem in one of those 4. So a maximum of 12 needed overall - will be interested to see if anyone can do better than this!
Edit: Have figured out several other patterns that use a maximum of 12 squares, but can't do better than that so far...