"When the ark of the Lord's covenant came into the camp, all Israel raised such a great shout that the ground shook. Hearing the uproar, the Philistines asked, ''What's all this shouting in the Hebrew camp?' When they learned that the ark of the Lord had come into the camp, the Philistines were afraid. 'A god has come into the camp,' they said. 'Oh no! Nothing like this has happened before. We're doomed! Who will deliver us from the hand of these mighty gods? They are the gods who struck the Egyptians with all kinds of plagues in the wilderness.'" NIV translation
The Israelites were glad when they brought the ark of the Lord into the camp because they assumed that God was with them. The Philistines heard the noise and, when they found out that the ark was there, they were afraid. We see that they had heard about what God had done in Egypt for His people.
"'Be strong, Philistines! Be men, or you will be subject to the Hebrews, as they have been to you. Be men, and fight!'" NIV translation
The leaders of the Philistines urged their men to fight. They reminded them that, if they did not, then they would be slaves to the Israelites. They did not know that God was not in the Israelite camp but they were able to overcome their fear because they didn't really have any other option.
"So the Philistines fought, and the Israelites were defeated and every man fled to his tent. The slaughter was very great; Israel lost thirty thousand foot soldiers. The ark of God was captured, and Eli's two sons, Hophni and Phinehas, died." NIV translation
The Israelites were routed and the ark was captured by the Philistines. God's word concerning Eli's sons was brought to pass as they were both killed on the same day.
This is a reminder to us that the best laid plans of man are nothing when they come up against God's plan. It also reminds us that we cannot assume that God will be with us when we are not following Him because He will not. God leads; He does not follow.