In a hypothetical world, if a wave were to travel unobstructed, it would never lose its energy. That said, the ocean is full of obstructions, such as the ocean floor, winds, currents, etc. Even if these obstructions are small, the friction will slowly drain the wave's energy.