I think a lot of it occurred after. This article claims that the Arab defeat in 1948 was used as a justification for plans that were already in place.
Not the most succinct article, but it explains some of it:
Why Jews Fled the Arab Countries - Middle East Quarterly
This one gives better country by country explanations:
Jewish Refugees from Arab Countries