In the poem, the bar is the barrier between life and death. In a harbor, there is a wave break, keeping the large waves from breaking the boats. It is also the land(or solid ground) that comes closest to the actual sea, and the last bit to pass on the way out. The "moaning at the bar" is where the people left behind would be gathered to follow as far as possible, and he says not to be too sad that he left them behind.