You can build roads and railroads on the ocean. Get a settler or and engineer into a vessel, go to the position in which you would like to build the road or railroad. Press R. You will gain the benefits of having roads and railroads on the ocean of extra trade.