Loggers used to sink logs in water to keep them from rotting. Keeping wood wet is a pretty good preservative.
What gets to wood is critters. A lot of sea creatures will nibble away at it. On land, it's insects and fungus and the like. Tidal action will also scour away exposed wood.