In short, the problem was this: The Muslims didn't see any value in anything the infidels thought or said or did. For example, almost no books were translated from European languages into Arabic. The Europeans translated everything they could. Islamic chauvinism was so bad that when the Ottomans lost one particular war and had to negotiate a treaty with the Europeans, they couldn't find anyone on the Sultan's staff who could speak any European languages, so they dragged some poor Christian dhimmi out of their Balkan provinces and had him act as translator. Since the translation was so cumbersome, he ended up acting as negotiator for the empire!
The Ottomans were able to last so long because they had military superiority. The elite Janissary infantry combined with horse archers were more than a match for almost everyone for hundreds of years. When the Europeans finally developed technologies and strategies for coping with them, it took the Ottomans completely by surprise as the Ottomans didn't bother to monitor the Europeans at all.
After several defeats at the hands of the Europeans, the Ottomans still didn't fully adopt Western methods. They tried, but Islam and Sharia kept getting in the way. The result was an Ottoman economy and military that was hopelessly behind. For instance, when WW I broke out, the Empire had only a few hundred miles of rail while their opponents had thousands. Rail was the primary way to move troops and keep them supplied so the Ottoman forces were immobile and undersupplied most of the time. The Ottomans had clung to their old ways of doing things and didn't industrialize.
I could go further, but I think that makes the point. Islam brought together racially diverse peoples into a single, cohesive empire, but ended up being the reason the Empire eventually failed.
|The Ottoman railway system, ca 1914. Note that the largest Ottoman offensives were carried out in the Caucasus against the Russians were there were almost no railways at all.|
|The German railway system, ca 1910. Enough said.|