Dubai and UAE have varying degrees of tolerance to clothing styles from across the world. Nevertheless, dress code in Dubai is quite liberal, in comparison to several other states in the Middle East. There are legal guidelines about what is acceptable, but, in general people are mostly allowed to wear what they like. However, it would be wise to tone down your dress code in other emirates of UAE (other than Dubai), especially in areas where there is greater proportion of nationals or Emiratis.
Usually Arab nationals from GCC countries, wear clothing similar to that otherwise worn in Dubai and UAE.
Dress code in public places in Dubai
In general most 'normal' clothing is tolerated, provided, it is not too outrageous.
Women do not have to cover their heads, faces and hair with a scarf or something similar when in public, although Muslim women, particularly Gulf Arabs, do cover their hair, faces, heads with scarf for cultural and religious reasons. But, when visiting a Mosque, women have to cover their hair, bodies and legs, although covering the face is not a must.
To be respectful of the UAE culture, it is best to remain covered from shoulder at least to the knees. For instance, although t-shirts (preferably with sleeves covering at least upper arm) are fine, spaghetti tops for women may not be appreciated in public areas. Also, very tight and/or low-cut t-shirts are also considered offensive. Females wearing strappy tops may be in for a warning at Dubai shopping malls, or shopping centres.
It is best to not to keep the skirt length above the knee level. As skirts get shorter in length, there is higher risk of male attention, police arrest and fine.
When visiting a government office (including visa, driving license, hospital), women are required to dress more conservatively.
In more traditional areas such as villages and souks, markets and such other areas, short skirts are not considered appropriate for women, and long-skirts below knee length are preferred. Western tops with deep neck lines are strictly prohibited.
Men wearing shorts, although may be considered odd, are unlikely to get into trouble. However, cycling shorts that reveal certain contours or boxer shorts may result in warning from the authorities. Wearing cycling shorts when cycling should be fine.
Sports clothing appropriate for the sport being played is allowed at the sports venue. However, any combinations of t-shirts and shorts are not a problem, even if worn elsewhere on the way from sports location. At the beach, a swimsuit is acceptable.
When visiting a Mosque, men are required to be dressed in long trousers.
T-shirts with offensive slogans or pictures, gestures, or obscene language that might cause religious or cultural offence are not acceptable in Dubai.
Official wear in Dubai
Women can usually wear similar clothing as when working in their home countries, although, anything extreme should be toned down. Women are expected to wear dresses or knee-length skirts or full length trousers, with t-shirt sleeves covering the upper arm of their body. But, the best thing would be to check with the company you are working in, about any special rules, or better still, is to be conservative when you first arrive.
Smart casual is fine for office wear. Males are expected to wear long trousers. Shorts are mostly worn only by swimming pool attendants, tennis coaches etc. A short or long-sleeved collared shirt is considered standard in most cases. A tie is commonplace, and expected in many jobs. A jacket or suit may not be much in demand (unless if visiting some high profile professionals). Best is to check with your company.
Note: Keeping in mind the climate in Dubai, it is best to go in for natural fabrics such as cotton, linen, and wool that suit many people better, than any sort of artificial fabrics (including polyester). Almost all offices in Dubai are Air-Conditioned, given, the hot temperatures in the emirate.
Consequences of not following the dress code
If caught wearing an offensive dress, and receiving a warning, it is best to apologize and fix the offending item, or at least fix it immediately. However, on arguing with the concerned person, matters may get worse, and police may be called.
On being caught in such a scenario, possibilities are one month imprisonment, followed by deportation. Although, the police may not walk around particularly looking for offensively dressed visitors, but, they will surely respond to complaints.