For 7 months the Philistines had the Ark of the Covenant in their territory. They realized this was no trophy or prize. This was a problem for them, and they were connecting the dots between all of the problems they are dealing with and the arrival of this Ark. So, to try to free themselves of trouble they decide to send it back to Israel. They also sent back gold rats and models of the tumors. This was to them an offering to cover up their taking of the Ark. The hope was that by returning the Ark with a gift they would be free from their plagues. It took them 7 months, but they finally do the right thing. Isn't it amazing how it can take us a long time to figure out a pretty simply thing- if this is causing me trouble I better get rid of this.
Israel's joy of receiving the Ark was overcome by sadness when they unwisely looked inside the Ark. From a human perspective they were probably thinking we need to make sure everything is still inside- commandment tablets, Aaron's staff, and a jar of manna. The problem is though their intent may have been good their actions were in direct violation of God's commands regarding how they were to handle and respect the Ark. This was holy and they needed to treat it as such by obedience to God's commands. Even a "good intentioned" disobedience of God's ways is destructive for our lives. We must trust and obey.