The short answer to your question is that the general avoidance of consuming pork meat is not unique to Islam, and dates back at least roughly to the ancient Egyptians.
The oldest confirmed evidence of pigs domesticated and kept for pork meat come from Hallan Cemi in Southeastern Anatolia from about 8000 BC. Shortly thereafter, the consumption of pork appears to have spread rapidly around the region, with domesticated swine becoming all but ubiquitous in the area by the year 5000 BC.
Pork meat at this time was an extremely common food, and as far as I can tell, was not banned or eschewed by any particular group. In fact, in several of these early cultures, pigs actually had a religious significance. For example, both the ancient Greeks and Old Kingdom Egyptians sacrificed pigs to a variety of deities.
However, all of this began to change very rapidly in a variety of communities around the region starting roughly 1000-1500 BC. Around this time, in ancient Egypt, pigs acquired a reputation for being unclean, a view that seems to have stuck through modern day. While lower castes of Egyptian society were not prohibited from eating pork, it was discouraged, and the priestly caste was forbidden from it entirely. Slightly later, the Israelites banned the consumption of pork. This law was later written down in the Bible (Leviticus), stating that pigs are not fit to eat because they are not cud-chewers. Various Jewish and Christian sects still adhere to this rule to this day.
While these specific groups were not by themselves a majority of the population in the Middle East, these groups did manage to spread the reputation of pigs as "unclean animals", which greatly decreased the consumption of pork in the region, even where they weren't explicitly banned.
Thus, from roughly 500 BC to the time of the founding of Islam, pork was an uncommon meat in the Middle East. Though pigs were occasionally raised and consumed, it was still not an encouraged practice for most people.
My main source for this post is The Cambridge World History of Food's page on Hogs.