Its not that they were not prepared for war or opposition. That would have been foolish of them. The core thing is that they were led by the spirit of God. Now pause, lets unpack that. Being led by God or the Spirit is the same. It is the provision of a divine direction to a child of God. In an article by the Nigerian Guardian, September, 2020, Princewill Ireoba did an excellent work on this. He explains the four passages in the New testament which deals with this: John16:13-15; Rom.8:14-16; Gal.5:17-18, and Luke 4:1. Its in Luke that we read of Jesus being led by the Spirit into the wilderness. So God led the people of Israel through the longer route. Life is not always on the speed lane. So long as you are being led by God, you will end up in the sure lane. Ireoba says such leading will keep a Christian from stumbling or derailing. The leading of the Spirit of God must be based on the word of God. It is the revealed will of God. This is what separates religious drama from the leadership of God. In 2019, Kenneth Copeland pointed out four ways you may be led by the Spirit to include: meditating on the word of God, being a doer of the word, putting the word above all else and instantly responding to the word. That still holds true today. It takes training of the human spirit to know how you may be led by visions, prophecy, conscience, inward witness and others. They all must align with the word. Where are you being led today? If it looks like a wilderness, but God is involved, follow Him. There will be manna in the way.
But God led the people about, through the way of the wilderness of the Red sea: and the children of Israel went up harnessed out of the land of Egypt. Exodus 13:18 KJV