The Jews are leaving Egypt. The route seems a bit roundabout, so the passuk describes in 13:17 that Hashem did not lead them through the short route via the land of the Philistines, lest they should see the potential for a war breaking out and that would frighten them to running back to Egypt.
Why would they want to go back to Egypt? After all the suffering they went through, after the beatings, the hard work, the oppression, etc. They have finally broken out and are free, yet we are still concerned that they might want to go back at the slightest threat of violence?
Also, let's say they went via the land of the Philistines. Let's say they would be afraid of battle. Woudl they want to go back and not trust Hashem after all they have seen Hashem do until now? Was it really such a concern that they would want to return to Egypt? Would they not think Hashem could/would help them be victorious?
People prefer what they are familiar with. In Egypt they had their routines. True, it was not pleasant. But they knew what to expect. They had gotten used to it.
To go into the desert and find yourself in a situation of possible war, they very well might prefer the evil with which they were already familiar rather than the new concerns.
Because of that, Hashem had to be concerned they might want to go back, despite all that He had already done for them.