Nitpick: A navy doesn't necessarily need a harbour directly at the high seas. Austria has had a navy with patrol vessels on the river danube from which they could theoretically reach the high seas until 2006. Also: Military installations on foreign soil are not all that uncommon (as I'm sure Americans can appreciate). I believe that Austria has had vessels in Trieste, even when Trieste was already part of Italy and Austria was already landlocked.
Why would that prevent them from having a small navy? Assuming some country is happy for them to pay to have a port somewhere. Although they don't it wouldn't surprise me much to learn that they did have one despite being land-locked.
Bolivia has been landlocked since 1904, but has a navy with 5,000 personnel (patrolling the country's many large rivers and lakes) and... a naval academy! Which Peru grants access to the sea.
Of course, you'll note Austria isn't on that list.
Many moons ago I reconnected with an old friend who moved to Switzerland years before; just imagine my face when he told me he was working for a Swiss shipowner:).
> Assuming some country is happy for them to pay to have a port somewhere.
Because a port that you're only borrowing can quickly become a port that either you're trapped in or not welcome to come back to if either you or your host get involved in a military conflict.