This is a pretty open-ended question, as it's very situational and depends on lots of things such as play style, board setup, other players placement, resource distribution, etc. With that in mind, take this answer with a grain of salt.
In most cases, it is a good idea to build early Catan settlements, close to, but not on the coast, and then build roads toward the coast
Assuming that the number tiles are somewhat fairly distributed, I'll usually try and take this strategy and place my second settlement (in the snake draft) such that I can build one road and my third settlement to be on a port.
Some of the exceptions to this might be:
- Crowding. If the folks you are playing with are hogging the coasts and leaving the middle more bare, forward settle them. You'd have the advantage of potentially blocking them from moving in towards the island, which could keep tiles for yourself.
- Attempting longest road. As you briefly mentioned, it may be in your best interest to start building wide and connect your empire. I'd say this is rare (going for longest road over preferable resource placement), but certainly not impossible. Especially if you're going 4th, you can potentially guarantee connecting your initial settlements early on. Personally, I've found it better to not ever go into the game planning longest road. If it comes around as an opportunity later in the game, great. If not, then there are plenty of other ways to get VP's.
- The number tokens are not well balanced. If you do not place the number tokens in the recommended pattern (or place the desert in-between two outer edges which would offset the tokens), then there might be a particularly good spot (e.g. 6-8-4) that would probably supersede shooting for a coast.