Yes, you can. Foreigners are allowed to buy property in special freehold zones in Dubai and Abu Dhabi. When buying a property worth AED 750,000 (~$204,000) or more, a foreigner can apply for a UAE resident visa.