There are several functions of setting in this play. Most simply, because it is set "somewhere else" (other than England), as a dramatist Shakespeare can use wild local customs. Since it is Asia Minor, he can use the customs of the exotic East, raising the stakes in the drama by the threat of a death penalty.
Since it is part of the Greek world, he can evoke lots of the historical/mythic references and use such names.
Since it is a port, he can expect lots of walk on characters (including unknown people) and lots of action (and the shipwreck); since it is at war he can make the stakes higher.