After the expansion of Arab and other Muslims into the Middle East from the Arabian Peninsula, Jews, along with Christians and Zoroastrians, typically had the legal status of dhimmi. As such, they were entitled to limited rights but fewer than those of muslims.
The Constitution of Medina, written shortly after hijra, addressed some points regarding the civil and religious situation for the Jewish communities living within the city from an Islamic perspective. For example, the constitution stated that the Jews "will profess their religion, and the Muslims theirs", and they "shall be responsible for their expenditure, and the Muslims for theirs". Rarely did Jews live with such freedom. After the Battle of Badr, the Jewish tribe of Banu Qaynuqa allegedly breached treaties and agreements with Muhammad. The Islamic founder regarded this as casus belli and besieged the Banu Qaynuqa. Upon surrender the tribe was expelled. The following year saw the expulsion of the second tribe, the Banu Nadir, accused of planning to kill The Prophet Muhammad. The third major Jewish tribe in Medina, Banu Qurayza was eliminated when the Muslims besieged their fortifications not long after the fall of the Banu Nadir, an event reported in Surah 33:25-27 of the Qur'an.
In year 20 of the Muslim era, or the year 641 AD, Muhammad's successor the Caliph 'Umar decreed that Jews and Christians should be removed from all but the southern and eastern fringes of Arabia—a decree based on the (sometimes disputed) uttering of the Prophet: "Let there not be two religions in Arabia". The two populations in question were the Jews of the Khaybar oasis in the north and the Christians of Najran. Other sources report the forced deportation of Jews and Christians occurring in 634 AD, with the last remnants of these two monotheistic religions being removed from the Arabian peninsula by the year 650. From this point onwards the Holy Land of the Hijaz was forbidden to non-Muslims. Only the Red Sea port of Jedda was permitted as a "religious quarantine area" and continued to have a small complement of Jewish merchants.
In much of the rest of the Muslim world of the Caliphate, and into the early Middle Ages, Jews retained a relatively secure position within Muslim society, achieving powerful positions in the great Muslim courts and centres of learning.
During early Islam, Leon Poliakov writes, Jews enjoyed great privileges, and their communities prospered. There was no legislation or social barriers preventing them from conducting commercial activities. Many Jews migrated to areas newly conquered by Muslims and established communities there. The vizier of Baghdad entrusted his capital with Jewish bankers. The Jews were put in charge of certain parts of maritime and slave trade. Siraf, the principal port of the caliphate in the 10th century CE, had a Jewish governor.
Throughout history, there have been numerous instances of pogroms against Jews. Examples include the 1066 Granada massacre, the razing of the entire Jewish quarter in the Andalucian city of Granada. In North Africa, there were cases of violence against Jews in the Middle Ages, and in other Arab lands including Egypt, Syria. and Yemen Jewish population was confined to segregated quarters, or mellahs, in Morocco beginning from the 15th century. In cities, a mellah was surrounded by a wall with a fortified gateway. In contrast, rural mellahs were separate villages inhabited solely by the Jews.
The Almohads, who had taken control of much of Islamic Iberia by 1172, far surpassed the Almoravides in fundamentalist outlook, and they treated the dhimmis harshly. Jews and Christians were expelled from Morocco and Islamic Spain. Faced with the choice of either death or conversion, some Jews, such as the family of Maimonides, fled south and east to the more tolerant Muslim lands, while others went northward to settle in the growing Christian kingdoms.
In 1400, the Jews of Aleppo were herded into their synagogues and slaughtered to the last man by soldiers of Central Asian Islamic conqueror Tamerlane; the young women were raped. These actions taken by Timur's army do not necessarily exemplify a hatred towards Jews by Timur though, but rather an unfortunate casualty of war. Despite Timur's ill reputation as a brutal conqueror, there is evidence which asserts that Timur exhibited tolerance towards Jews residing within his empire. In 1465, Arab mobs in Fez slaughtered thousands of Jews, leaving only 11 alive, after a Jewish deputy vizier treated a Muslim woman in "an offensive manner." The killings touched off a wave of similar massacres throughout Morocco.
The Ottoman Empire had served as a refuge for Spanish Jews who had been expelled from the Kingdom of Spain and its territories and possessions, especially after the fall of Muslim Spain in 1492 and Edict of Expulsion. This was also the case for the Maghreb in North Africa, where a Jewish quarter (Mellah), was installed in most large Arabian cities. Later the Jewish converts were driven out of Spain fleeing the Roman Catholic Inquisition.
In 1656, all Jews were expelled from Isfahan because of the common belief of their impurity and forced to convert to Islam. However, as it became known that the converts continued to practice Judaism in secret and because the treasury suffered from the loss of jizya collected from the Jews, in 1661 they were allowed to revert to Judaism, but were still required to wear a distinctive patch upon their clothings.
There was a massacre of Jews in Baghdad in 1828. In 1839, in the eastern Persian city of Meshed, a mob burst into the Jewish Quarter, burned the synagogue, and destroyed the Torah scrolls. It was only by forcible conversion that a massacre was averted. There was another massacre in Barfurush in 1867. In 1839, the Allahdad incident, the Jews of Mashhad, Iran, now known as the Mashhadi Jews, were coerced into converting to Islam.
"…they are obliged to live in a separate part of town…; for they are considered as unclean creatures… Under the pretext of their being unclean, they are treated with the greatest severity and should they enter a street, inhabited by Mussulmans, they are pelted by the boys and mobs with stones and dirt… For the same reason, they are prohibited to go out when it rains; for it is said the rain would wash dirt off them, which would sully the feet of the Mussulmans… If a Jew is recognized as such in the streets, he is subjected to the greatest insults. The passers-by spit in his face, and sometimes beat him… unmercifully… If a Jew enters a shop for anything, he is forbidden to inspect the goods… Should his hand incautiously touch the goods, he must take them at any price the seller chooses to ask for them... Sometimes the Persians intrude into the dwellings of the Jews and take possession of whatever please them. Should the owner make the least opposition in defense of his property, he incurs the danger of atoning for it with his life... If... a Jew shows himself in the street during the three days of the Katel (Muharram)…, he is sure to be murdered."
In 1840, the Jews of Damascus were falsely accused of having murdered a Christian monk and his Muslim servant and of having used their blood to bake Passover bread. A Jewish barber was tortured until he "confessed"; two other Jews who were arrested died under torture, while a third converted to Islam to save his life. Throughout the 1860s, the Jews of Libya were subjected to what Gilbert calls punitive taxation. In 1864, around 500 Jews were killed in Marrakech and Fez in Morocco. In 1869, 18 Jews were killed in Tunis, and an Arab mob looted Jewish homes and stores, and burned synagogues, on Jerba Island. In 1875, 20 Jews were killed by a mob in Demnat, Morocco; elsewhere in Morocco, Jews were attacked and killed in the streets in broad daylight. In 1897, synagogues were ransacked and Jews were murdered in Tripolitania.
By the late 1940s, conditions of the Arab Jews in many Muslim countries were rapidly worsening through a combination of growing Arab nationalism due to European occupation; Nazi influence in the Axis controlled parts of North Africa; and the conflict in the British Mandate of Palestine. The situation came to a head after 1948 Arab-Israeli war, historically the first military struggle between Jews and Muslims. After many Muslims were expelled from their ancestral homeland in Palestine, many Arab states instituted formal discriminatory laws against their Jewish populations. Within a few decades, most Jews fled Muslim lands, most for the newly created Jewish state, but others went to France, the United States, Great Britain and other Commonwealth nations. In 1945 there were between 758,000 and 866,000 Jews living in communities throughout the Arab world. Today, there are fewer than 8,000. In some Arab states, such as Libya which was once around 3 percent Jewish, the Jewish community no longer exists; in other Arab countries, only a few hundred Jews remain. The largest communities of Jews in a Muslim land exist in the non-Arab countries of Iran and Turkey; both, however, are much smaller than they historically have been.