It's the aftermath of the first Israeli Arab war
The second Israwl was established just about all the countries in that region attacked it right away.
Egypt, Yemen, Saudi Arabia, Lebanon, Syria, Iraq and what is now modern day Jordan all teamed up and invaded Israel. A neighborhood welcome party.
Israel won and took some buffer territory around it just in case all these countries would decide to invade it again. All those countries ended up trying to invade Israel two more times (6 day war and Yom Kipur War)
It is very unfortunate what happened to the people displaces by these wars. The Arab League shouldn't have tried to wipe Israel off the map in the first place.
The Arab counter attack?
During the first phase of that war, the Civil War from November 47 to May 14, 1948 it was Arab militias that attacked Jewish communities.
During the second phase of that war, it was the Arab League that invaded Israel on May 15, 1948
Imagine if the Arab states never invaded from the beginning and just were ok with Jews existing next door to them.
We know the Jews would have been ok with Arab Muslim states existing next to them as there are currently many Arab Muslims living and working in Tela Viv.