You can achieve this if your site is based on a scripting language like PHP. With every page request your scripts first check the IP address of the visitor. Based on the country associated with that IP address a 301 header is generated, or the regular content of the page is displayed.
You don't need to maintain a list of IP address and country associations yourself. There are paid and free IP databases available which you can use from within your scripts. You should know that these databases are not 100% accurate so you may now and then redirect visitors erroneously. Also frequent updating of the database is necessary because new IP address blocks are handed out on a continuous base.
you can certainly redirect based on referer (HTTP_REFERER), such as www.google.ae, or based on an IP (REMOTE_ADDR) of a visitor which location is known. for the latter you will need to use an IP geolocation database.
in general, if you treat the crawler in the same way as you treat the search-referred visitor, you'll probably be ok. however you should be aware that any time you are cloaking you are playing with fire, so you need to know precisely what you are doing, why and how.