From how I understand the history, in 1948, the attacking Arab armies from neighboring countries told the local Arabs (Palestinians) to leave the war zone to be safe. But when Israel won the war, those Arabs could not return.
The way I heard it, there was a bit of everything. There was some attacks because of the violence that had been happening previously, some fled because of rumours of violence, and some were encouraged by the Arab armies.