From the Babylonian period to the rise of the Islamic caliphate , the Jewish community of Babylon thrived as the center of Jewish learning. The Mongol invasion and Islamic discrimination in the Middle Ages led to its decline.
Under the Ottoman Empire , the Jews of Iraq fared better. The community established modern schools in the second-half of the 19th century. 
Most of the Jewish elite that had been exiled from Jerusalem and held captive in Babylon, stayed in Babylon after Cyrus gave permission for captive peoples to return to their homeland.
Not only was Babylon not desolated in those periods, but it became, especially after the destruction of Jerusalem by the Romans, (and the later building of a Roman city (with a Temple to Jupiter) on the site of the destroyed Jewish city) the most important centre for Jewish worship and study.
Here's a wikipedia entry on Babylon and area as teh centre of Jewish worship:
Babylonia as the center of Judaism
Further information: Talmudic Academies in Babylonia
After the fall of Jerusalem, Babylon would become the focus of Judaism for more than a thousand years, and the place where Jews would acclimate themselves as a people without a land.  The Jews of Babylon would even for the first time, write prayers in a language other than Hebrew such as the Kaddish, written in Judeo-Aramaic, a harbinger of the many languages Jewish prayers would come to be written in such as Greek, Arabic, and Turkish in the diaspora.
The rabbi Abba Arika (175-247 AD), or "Rab" due to his status as being the highest authority in Judaism, is considered by the Jewish oral tradition the key leader, who along with the whole people in diaspora, maintained Judaism after the destruction of Jerusalem. Rab quietly left Iudea Province to return to his Babylonian home, the year of which has been recorded as (530 of the Seleucidan, or 219 of the common era), this is considered to mark the beginning of a new era for the Jewish People. This is seen as the initiation of the dominant rôle which the Babylonian academies played for several centuries, for the first time outmoding Judea and Galilee in the quality of Torah study. Most Jews to this day rely on the quality of the work of Babylon during this period over that of the Galilee from the same period. The Jewish community of Babylon was already learned, Rab just focused and organised their study. Leaving an existing Babylonian academy at Nehardea for his colleague Samuel, Rab founded the new Sura Academy, where he and his family already owned property, and was known as a Jewish city. This created an environment which Babylon had two contemporary leading academies, competing with one another, yet so far removed from one another, they could never interfere with each other's operations. Since Rab and Samuel were the acknowledged peers in position and learning, their academies likewise were accounted of equal rank and influence, this can be compared in Judea Galilee and Iudemea Province academies to the House of Hillel Ha-Zaken and the House of Shammai had a similar relationship, albeit Rab and Shemuel agreed far more often than the respective houses of Hillel and Shammai who nearly never agreed on the Law. Thus both Babylonian rabbinical schools opened this new era for diaspora Judaism well, and the ensuing discussions in their classes furnished the earliest stratum and style of the scholarly material deposited in the Babylonian Talmud. The coexistence for many decades of these two colleges of equal rank even after the school at Nehardea was moved to Pumbedita (now Fallujah) produced the first time the remnants of the Judeans had to live with dual leadership at the same time, with some slight interruptions, this became a permanent fixture and a weighty factor in the development of the Jewish faith as we know it today.
The key work of these semi-competing academies was the compilation of the Babylonian Talmud, (the discussions from these two cities) completed by Rav Ashi and Ravina, two succeeding leaders of the Babylonian Jewish community, around the year 520, though rougher copies had already been circuated to the Jews of the Byzantine Empire. Editorial work by the Savoraim or Rabbanan Savoraei (post-Talmudic rabbis), continued on this texts grammar for the next 250 years; much of the text did not reach its "perfected" form until around 600-700 AD. The Mishnah which had been completed in the early 3rd century AD and Babylonian Gemara (the discussions at and around these academies) together form the Talmud Bavli(the "Babylonian Talmud").
The three centuries in the course of which the Babylonian Talmud was developed in the academies founded by Rab and Samuel were followed by five centuries during which it was intensely preserved, studied, expounded in the schools, and, through their influence, discipline and work, recognized by the whole diaspora. Sura and Pumbedita were considered the seats of diaspora learning; their heads and sages were the weighty authorities, whose decisions were sought from all sides and were accepted wherever diaspora Jewish communal life existed. They even successfully competed against the learning coming from the Roman provinces of the mythologised "Land of Israel" itself. In the words of the haggadist, "God created these two academies in order that the promise might be fulfilled, that 'the word of God should never depart from Israel's mouth'" (Isa. lix. 21). The periods of Jewish history immediately following the close of the Talmud are designated according to the titles of the teachers at Sura and Pumbedita; thus we have the time of the Geonim and that of the Saboraim. The Saboraim were the scholars whose diligent hands completed the Talmud and the first great Talmudic commentaries in the first third of the 6th century (however earlier commentaries had already been completed in the Galilee, for example by Greek convert Unkoles). The two academies among others, and the Jewish community they lead, lasted until the middle of the 11th century, Pumbedita faded after its chief rabbi was murdered in 1038, and Sura faded soon after. Which ended for centuries the great scholarly reputation given to Babylonian Jews, as the center of Jewish thought.