Devil
reject modernity embrace masculinity
There's an assumption in the question that Allah isn't already helping Muslims deal with foreign occupations. That's not necessarily the case. Allah is always helping Muslims -- providing food, shelter and many mercies. I assume more generally what you were asking was along the lines of: "If the Muslims are being occupied, why does Allah not grant them victory over their occupiers?"
There are a few reasons that I have observed.
Lack of Faith/Iman
Muslims believe that Allah says in the Qur'an: "Allah does not change the condition of a people until they change what is in themselves." (http://quran.com/13/11). Also "O you who believe, if you support Allah, he will support you and plant your feet firmly" (http://quran.com/47/7). Just because a country is Muslim by name doesn't mean that the people there really practise Islam correctly.
Inappropriate means/behaviour
Many Muslims are resorting to means that are outside of Islamic teachings. For example, terrorism and the killing of innocent people which is against the teachings of Islam; but also in their personal lives, people are not really living up to Islam's teachings. Supporting Allah (in the above verse) also means obeying him. How can people expect victory when there is widespread disobedience of Allah?
Impatience
We expect results immediately, but that is not the case. Even the Prophet, who was our exemplar, had to be patient for 22 years before victory came with the bloodless conquest of Makkah.
The Qur'an says: "Or do you think that you will enter Paradise while such [trial] has not yet come to you as came to those who passed on before you? They were touched by poverty and hardship and were shaken until [even their] messenger and those who believed with him said,"When is the help of Allah ?" Unquestionably, the help of Allah is near." (http://quran.com/2/214).
Even looking at history, there are many instances where Muslims were victorious over occupying forces, but it took a long time. For example, the occupation of Afghanistan by the Russians lasted 10 years (http://en.wikipedia.org/wiki/Soviet_war_in_Afghanistan). Similarly, Indonesia's war of independence from the Dutch from 1945 to 1949.
not me
There are a few reasons that I have observed.
Lack of Faith/Iman
Muslims believe that Allah says in the Qur'an: "Allah does not change the condition of a people until they change what is in themselves." (http://quran.com/13/11). Also "O you who believe, if you support Allah, he will support you and plant your feet firmly" (http://quran.com/47/7). Just because a country is Muslim by name doesn't mean that the people there really practise Islam correctly.
Inappropriate means/behaviour
Many Muslims are resorting to means that are outside of Islamic teachings. For example, terrorism and the killing of innocent people which is against the teachings of Islam; but also in their personal lives, people are not really living up to Islam's teachings. Supporting Allah (in the above verse) also means obeying him. How can people expect victory when there is widespread disobedience of Allah?
Impatience
We expect results immediately, but that is not the case. Even the Prophet, who was our exemplar, had to be patient for 22 years before victory came with the bloodless conquest of Makkah.
The Qur'an says: "Or do you think that you will enter Paradise while such [trial] has not yet come to you as came to those who passed on before you? They were touched by poverty and hardship and were shaken until [even their] messenger and those who believed with him said,"When is the help of Allah ?" Unquestionably, the help of Allah is near." (http://quran.com/2/214).
Even looking at history, there are many instances where Muslims were victorious over occupying forces, but it took a long time. For example, the occupation of Afghanistan by the Russians lasted 10 years (http://en.wikipedia.org/wiki/Soviet_war_in_Afghanistan). Similarly, Indonesia's war of independence from the Dutch from 1945 to 1949.
not me