https://qz.com/335183/heres-why-men-on-earth-outnumber-women...
The "manual labor" class in particular brings in a lot of men on employment visas. There are also regulations that restrict a person on a visa from bringing their spouse with them unless they have a certain income level. So a lot of the men on visas are there alone, further skewing the population.
Note that there's no path to citizenship in these countries. If you come in on a visa you'll always be a guest on a visa. So you always face these restrictions on bringing your spouse into the country.
If you look at the demographics of UAE, the vast majority of the population is people who are not citizens of UAE. UAE is more honest than Saudi when it comes to this stuff, hence why I'm pointing to the UAE stats, not Saudi's - https://en.wikipedia.org/wiki/Demographics_of_the_United_Ara...
The age structure is also interesting. Since 85% of the populations is non-citizens, the vast majority leave the country at retirement age. So even if you get to the point where your income and circumstances allow you to bring your spouse into the country, you'll end up leaving and the population skews to younger male workers.
At least in UAE, female Arab nationals are out of the public eye, but non Arab females go to malls, walk around, drive cars, and are out and about. But yes, it's still odd to see the gender imbalance if you aren't used to it.