You can get it using coins to purchase it in the game corner at golden rod city. Its worth 200 game coins.
Safari Zone Desert Area after you give geodude to Baoba he calls you after a while and says you can switch areas in the safari zone and put desert in and thats where sandshrew is
Go to the Safari Zone after catching a geodude for Baoba. The you´ll have te option to put a dessert zone where sandshrew is.
In safari zone by changing areas