From Ibn Tufail's 12th century Hayy Ibn Yaqzan to Rokeya Sakhawat Hussain's 1905 feminist masterpiece Sultana's Dream, the Islamic world produced some of the earliest proto-sf, which IO9's Charlie Jane Anders rounds up in an excellent post.
Of course, Mary Shelley's novel Frankenstein is widely recognized as the first real work of science fiction, because it's a novel of speculation based on the scientific discoveries of her day. But there were a number of works before Frankenstein that feature a lot of what we'd consider the defining characteristics of SF.
The first of these is widely considered to be A True History by Lucian of Samosata, a Syrian author. This 2nd century novel follows a traveler who is transported via water spout to the Moon, where he encounters strange societies and bizarre life forms. But there are also a number of early claimants to the "proto science fiction" label coming out of the Islamic world
The Islamic Roots Of Science Fiction [Charlie Jane Anders/IO9]