It is shortsighted to think that, because we are Christians, God is always on our side to help us against our enemies. One of the primary ways God disciplines His people is to allow their enemies to prevail against them. It is foolhardy to assume that we can ignore and disobey God and yet He will steadfastly grant us success in all our endeavors.
We can be certain of this: if God turns His ear away from us, our failure is certain. We cannot afford to be careless in our walk with Him. It is foolhardy to wait until we are in the midst of a difficult conflict before we try and correct our walk with God. The midst of a battlefield is not the venue for returning to God. We need to enter into battle already confident that God goes with us.
Why does God allow us to face enemies? In part, it is so we are continually reminded of our need for Him. Times of peace and prosperity tend to make us lethargic or self-confident. But attacks from our enemies drive us back to dependence upon Him.