Here are some considerations:
It needs to be deep enough that you can get close to shore with a ship that extends several meters below sea level.
It needs to be protected from large waves, so a spit of land that goes around the harbor is useful.
It shouldn't be in a place where tides are large orand ships will be moving up and down over the course of a day by too much to make loading and unloading easydifficult.
It shouldn't be in a place where winds are frequently too strong to make operations difficult.