I understand that some Arab governments, most notably of Iraq and Syria, were exceptionally antisemitic, stripping Jews of citizenship before or after 1948 and sometimes encouraging popular violence against Jews like the notorious Baghdad pogrom during WW2.
Was this kind of violent antisemitism exceptionally brutal, or typical of the young Arab governments created after WW1? Were Arab governments seeking to expel their generally ancient and assimilated Jewish populations, or did any seek to prevent this huge exodus? Did any Arab leaders work to preserve these Jewish communities and separate anger at Israel from fury against the entire Jewish people?
Part 1:
There was a mixture of both, in truth. Some Arab governments reversed course, and the overall migration of Jews out of Arab states was quite diverse and remains quite controversial; not least because the property, belongings, and land stripped from them totaled over $100 billion in today's dollars, according to one group advocating today for them to be compensated (though of course, that group has a bias).
The primary Jewish exodus you're thinking of took place in the few years following the end of the Arab-Israeli war of 1948, when the Jewish population of Israel virtually doubled in 3 years. Many of those Jews came from European countries, but a healthy chunk came from the Arab world too, with most measures placing Iraqi immigrants as the largest group (over 130,000).
Arab governments were dealing with multiple conflicting goals when considering Jewish attempts to flee. On the one hand, while certainly not democratic, they also knew that a breakdown of public order and attacks on their Jewish citizenry could harm the stability of the state, as well as their relations with other countries. More importantly, they were also aware that this could spur even more emigration, which brings me to the second conflict: if Jews were allowed to leave, and chose to, then they might go to Israel and subsequently strengthen Israel, by enhancing its Jewish population. After all, by the end of the war, Israel was a state with no more than roughly 700,000 Jews and 150,000 Arab Muslim or Christian citizens, which was not an overwhelming disparity, particularly while surrounded by far more populous Arab states. Fleeing Jews would potentially give the state trouble in terms of accommodation, though, if they arrived penniless. So many Arab states went with the option of reversing initial decisions to forbid emigration (or to try to force it), and instead simply said that any Jew seeking to leave would have their property seized and would have to turn over any valuables before leaving.
Iraq, for example, initially barred Jews from fleeing the country to Israel for fear that it would strengthen Israel. This was what most Arab states chose to do, initially. But by 1950, they decided they would allow Jews to leave, but only if they agreed to lose their citizenship and only if they turned over all valuables. Jewish property could significantly help the Iraqi government's cashflow, and they were happy to seize it all. At that point of course, the Iraqi government went full reversal, and began encouraging Jews to leave in earnest, hoping to take their property for itself. Further, if a Jew declared intent to leave, they had to surrender their citizenship immediately, before they actually left; so many, while waiting to leave, were effectively stateless and in some cases in 1951, were also blocked from using any of their property. Within two years, a policy of forbidding Jewish emigration to Israel turned into a breakneck attempt to push them out quickly. This encouragement was hastened by bombs that, at least in part, may have been planted by Israeli agents targeting Jews to inspire them to flee. However, whether or not that is the case is quite unclear; it is hard to know if Iraq was lying when it hung the "Zionist agents" they held responsible for the bombings, given previous bombings had also targeted Jews and were not committed by accused Israeli agents. Inquiries in Israel have yielded no answers on who these accused agents of Mossad actually were, and if they indeed worked for the Mossad.
Iraq's case is exceptional because of the pure volume and haste with which Jews departed. Given they could only begin leaving in early 1950, it is incredible that by 1952, more than 120,000 Jews fled Iraq, and managed to do so in large part through airlifts by Israel. In 1952, Iraq reversed course again and re-banned Jewish emigration, following the alleged Mossad bombings, but barely 10,000 Jews remained in Iraq; more than 90% of Jews had already fled from a country with a formerly quite large and long-established Jewish community.
In Yemen, the situation was not much different. Yemen had roughly 50,000 Jews by 1948, and was a country with an established Jewish community. Similarly to Iraq, Israel was willing to encourage Jews to leave, and many wanted to. Riots targeted Jews in 1947 and onwards, and persecution was quite common. The Yemeni government was quite harsh to Jews already; it leveled high taxes on them generally, but also implemented policies in the early 1900s like the infamous "orphan's law", which said that any Jewish orphan would be forced to convert to Islam, taken from any extended family, and fostered by a Muslim family. Israel, with the agreement of the Yemeni leadership, began airlifting Yemeni Jews out of Yemen quite early in what was dubbed "Operation Magic Carpet", and more than 90% of that country's Jews left as well. Alaska Airlines made more than 400 flights to and from Yemen to ferry Jews to Israel. The Yemeni government did not have strong objections to this, and as I said, agreed to the plan to let the Jews leave.
Syria was slightly different. The Syrian leadership that heralded most of the Jews leaving was actually installed in a CIA-backed coup in 1949, right as the armistice agreements between Israel and the Arab world were being finalized. In fact, the armistice agreement between Israel and Syria was not finalized until after the CIA-backed coup had occurred, and negotiations didn't even formally begin until a month post-coup. Husni al-Zaim, the Syrian army's chief of staff, took power in March 1949. He inherited a state where, as in other Arab states, riots against Jews were increasing in frequency, and where prior policy had been to kill any Jew caught trying to emigrate to Israel. Jews were also forbidden from numerous businesses, and faced restrictions on property. While Zaim allowed Jews to emigrate, he was only in power for around 4 months, and so most of the Jews who fled Syria had to do so secretly and at great risk to themselves. As the years went on, more and more restrictions were placed on Jews, from freezing their bank accounts to restricting their ability to travel to seizing their passports, all in an attempt to prevent them from fleeing to Israel. Only around 5,000 of the more than 30,000 Jews in Syria in 1949 managed to flee to Israel during Zaim's short-lived regime, and so Syrian Jews left in more of a trickle over the coming decades than in a wave.
Jordan and the West Bank didn't have many Jews to begin with, but what few Jews remained largely fled after 1948. In the case of eastern Jerusalem, roughly 2,000 were expelled when Jewish forces fighting there surrendered. The same occurred in other areas where Jews were fighting in the West Bank.
Egypt was another source of Jewish immigrants, with over 70,000 by some measures. Egyptian riots and bombings of Jewish areas also grew in frequency and intensity after 1948. More than 2,000 Jews were arrested, and many more had their property confiscated by the government, which accused them all of being "Zionist agents". By 1951, about half had fled Egypt to Israel. Egypt, too, advocated in 1950 for a ban on all Jewish emigration from Arab states, but this did not stop Jews from fleeing on their own. In 1954, Mossad agents authorized by Israeli Defense Minister Pinhas Lavon attempted a false-flag operation, meant to encourage Western powers to attack Egypt and unseat Nasser, who had taken power in Egypt following the 1952 coup and following a couple of years of using the official leader as more of a puppet than anything else. The failure of this operation (which was not authorized by the Israeli Prime Minister) led to further recriminations and reprisals against Jews in Egypt, and following the Suez Crisis in 1956, Jews (and many others) were actually expelled from Egypt. By 1957, the Jewish population had decreased by over 75% from the years before.
I haven't even begun to talk about North Africa really, or about Muslim countries (rather than Arab ones) like Iran, but as you can see, there was a relatively uniform path to Jewish emigration. It began with a ban of Jewish immigration in most of these states, as well as persecution of Jews, which enhanced Jewish emigration through unofficial means. Eventually, most of these governments caved (if only temporarily), and allowed Jews to emigrate, during which time a large number did. The governments then often reimposed restrictions, and after a decade or two, turned to either more persecution or outright expulsion of the remaining Jews.
Part 2:
Most Arab leaders didn't really care to preserve these communities. Lebanon was the state last to turn on its Jewish citizens; while riots picked up in 1948, and debates over Jewish loyalty took place in the 1950s, Jews fled there perhaps the slowest in the Arab world (of the states with a large Jewish minority), and Lebanon was actually friendly enough to Jews that they allowed fleeing Syrian Jews to go through their territory to enter Israel.
But most Arab leaders called Jews traitors by default, and while (for example) Egypt tamped down riots relatively quickly, they were not altogether concerned with the decision by Jews to flee. They were happy to seize property left behind but also didn't want Israel strengthened by new immigrants, and as a result changed their minds quite frequently. In any case, it is rare to have seen an Arab state concerned with its Jewish citizens for reasons relating to those citizens' welfare, rather than how it helped or hurt the state to have their property or to have them flee to Israel. They were not keen on separating anger at Israel from Jews in general; in fact, they often encouraged exactly the opposite. After all, when the Jordanians took eastern Jerusalem, the commander reportedly said, "For the first time in 1,000 years not a single Jew remains in the Jewish Quarter. Not a single building remains intact. This makes the Jews' return here impossible". The Egyptian Prime Minister in 1947 said, "All Jews were potential Zionists [and] ... anyhow all Zionists were Communists". Some Arab League drafts of documents proposed policies whereby any Jew would be automatically considered a new citizen of Israel, would have to register with the Arab state as one, and would face frozen bank accounts from that point forward. The Iraqi Prime Minister, Nuri al-Said, reportedly told the British ambassador to Jordan and the Prime Minister of Jordan that he wanted to place Jews in armored cars, drive them to the Jordanian-Israeli border, and force them to cross it, which would mean forcing Iraqi guards to either shoot Arab rioters who would attack these convoys, or would mean the massacre of the Jews. Even the Jordanian Prime Minister reportedly said he did not want to be party to such a crime, and the idea was never put forward, but it was clear Jews were not something the Arab leaders cared much to preserve in their states, and that Jews were not separate from Israel in these leaders' eyes.