Re: 1st time boat owner, simple question
As was said it's flotation. Should your boat swamp, it's supposed to keep it afloat. If it was mine I would replace the foam, but encapsulate the foam so that water can't even get to it. I spent many years testing boats for flotation for the USCG and this water soaking problem is not as widespread as some believe but it is a problem especially in older boats. The quickest and easiest solution is to keep the water away from the foam. Some builders encapsulate it in fiberglass (use epoxy resin, polyester resin dissolves the foam.) Others put the foam in a heavy guage plastic bag and seal the bag. Either way prevents the water from getting to the foam. Oh and by the way, if you have soft spot in the deck (in boat building parlance a floor is a verticle beam holding up the deck) and the deck is wood under glass or wood covered with glass, you probably have a serious problem and need to replace the deck. So while you do that, replace the foam.
26aft's idea is ok up to spraying that foam in. That spray can foam is actually worse at absorbing water than the stuff you already have.
But I have seen eeverything you can imagine for floation from plastic bottles to ping pong balls. If it traps air, it works.