A submarine has to keep many atmospheres of pressure out. A starship has to keep one atmosphere of pressure in. Very different design problems.
Shields and starship hulls have to keep out impact events in space (space junk can hit pretty hard due to its velocity, and it's not all going to come head on for the navigational deflector to stop it, which is still a "shield"), which is an order of magnitude higher than the pressure on the whole ship when submerged on an earth-like planet. A metal bolt hitting at 20 km/s is harder to protect against than water pressure (earth-like ocean), and we don't see this bothering starships in Trek.
Not to mention being able to withstand the most common threats in battle to some extent (which has shown to be true in Star Trek -- ships seem to be able to withstand a certain amount of battle damage), which again, will be far higher than the pressures of an earth-like planet's oceans.