Empires conquer; people create. The two have always coexisted, Islam’s history isn’t unique in that regard.
Edit: Let me expand on this. The scholars came from multiple faiths, Muslim, Jewish, Christian, Persian, all working under Islamic rule. So it wasn’t the religion doing the science, but...