Several points. Not all of them (especially the first) are equally applicable in each case. But, most of the points apply to all of them.
1. Monarchies work well when the economy is dominated by rents from property.
In Europe, monarchies gave way to representative government historically, because in an increasingly commercial economy, rents made up a declining share of the economy and commercial activity from business people whom the monarchy did not control so directly and absolutely became important. So, at times of financial need, European monarchs traded acceptance of other taxes in exchange for political power.
In oil and gas based economies, like that of Saudi Arabia, the economy is still predominantly natural resources rent based, so the King doesn't need to impose significant taxation on his people, and doesn't need to give them a say in governance. The remaining monarchies are predominantly those which have rent based economies.
Indeed, oil and gas dominated economies are at an even greater edge that those with the agricultural rents of historical European monarchies. The share of the population doing the work is a tiny percentage of the share of the population that tended to fields generating feudal wealth, and many of those workers are foreigners who can be deported from lucrative positions on a whim.
In these monarchies, most sovereign wealth comes from ownership of resources, not taxation. There are also substantial social welfare benefits that are made available to the people at royal expense. So, the average person sees themselves as giving up little to get a lot in return, for living in a monarchy. Pocket book considerations end up trumping ideological considerations.
In contrast, regional republics, less well endowed with natural resources, have citizens who are paying significant taxes and not necessarily getting something that is so obviously worth their tax dollars in return (in part due to incompetence and corruption), sowing the seeds of potential dissent. Even when there is substantial oil and gas wealth in addition to other sources of national wealth, for example, in Iraq, largess from a monarch feels like a gift, while use of national resources by a republican regime feels like a tax.
This is less true in Jordan and Morocco, where inertia has been a major factor in keeping the monarchies in place. But both are still heavily reliant on natural resources - phosphate mining in both cases, potash mining in Jordan, and 40% of the population employed in agriculture in Morocco. Both Jordan and Morocco are in the process of transitioning from absolute monarchies to constitutional monarchies. Jordan has a freely elected lower house of parliament, a royally appointed upper house, a Western style and an Islamic judiciary, and a king who leads the executive branch and is about where England was at the time of the American Revolution in 1776 - democratization is, in part, to appease the people who have a very high (35%+) unemployment rate. Morocco is less far in the process of transitioning to a constitutional monarchy (it was upgraded from "authoritarian" to a "hybrid regime" by analysts in 2017), with the King still retaining more absolute power, but faces somewhat less economic pressure than Jordan to do so.
2. Foreign Deference
The world depends upon oil and gas wealth from these countries so the world tends to leave them alone in matters of self-governance. In contrast, both Libya and Syria fell into civil war after severe Western criticism.
Also, the monarchies have positioned themselves as more Western than their nation's legally established religious leaders, so Western countries that intervene face a likely prospect in a regime change of a transition to a more anti-Western theocratic regime.
3. Flexible Succession.
In Saudi Arabia and most other Arab monarchies, the kingship is not passed by strict primogeniture. The King may name any successor of his choice from the adult males of the royal family, a group including several hundred people. So, while it may not maximize meritocracy, the system allows kings to pass over weak potential rulers and to give his royal relatives real incentives to shine.
Many historical monarchies have stumbled in the face of weak monarchs. This is less likely in a more flexible arrangement.
Monarchies also provide a way for poor regimes (as they were before oil and gas was discovered) to use scarce national resources to have at least the royals and aristocrats receive full quality educations, which makes this class more competent than lay people even if elected and popular.
Their natural resource rents also make it possible to bring in outsiders to provide competence when it is not available domestically, which can be a challenging decision to make in a fledgling republic with nepotistic tendencies.
Incompetence by leaders and a shortage of educated competent senior civil servants has been a perennial problem in almost all developing countries and was, for example, a major reason that Sudan's Western-style parliamentary and legal regime quickly collapsed in favor of a dictatorial arrangement.
4. Legitimacy of succession and lack of corruption.
Arab and North African monarchies have had clear undisputed transfers of power, which are critical to building legitimacy.
Monarchies have also been, relative to Western-style regimes in the region, uncorrupt, because nepotism of a leader towards his family is not corruption, but the design of the system in a monarchy.
In contrast, Western-style regimes in the region in a largely clan based society where many people have tribal and clan affiliations and cousin marriage rates are very high, place family over the state and produce a comparatively corrupt political system. The dynamic is discussed, for example, in a case study of Arab towns in Israel. Frustration with the resulting corruption has been a major force behind movements seeking to restore an Islamic Caliphate. Many recent elections in non-monarchies there have been seriously disputed.
This legitimacy has also caused the public to accept ruthless measures to shut down dissent. For example, the most recent Crown Prince of Saudi Arabia has rounded up dissenters in the royal family, seized their resources and allowances, and confined them to hotels that are fancy jails, consolidating power in a way that a leader even in a non-democratic republic would be hard pressed to do.
5. Alliances with religious leaders.
In Saudi Arabia and other monarchies in the region, monarchs have built alliances with an established religious sect, removing a potential basis for dissent at the cost of ceding power over some matters to religious officials. This has cemented the power of both.
Egypt, Syria and Iraq, in contrast, have their origins in left-leaning, secular minded Western-style regimes that have antagonized religious leaders, creating a natural, well organized, architecture of dissent that resembles in some ways, the way that the occupying English in Ireland tried to suppress the Roman Catholic church and only solidified public support of it as a focal point of opposition to their English overlords.