I can recall reading some documentary about WWII subs. They indeed surfaced often to take celestial bearings. Now they just surfacing a tiny floating antenna on a cable. However, with the modern tech it's not that hard to implement either a gyroscopic sighting aid integrated in the periscope, or even a completely computerized celestial navigation system similar to those pinpointing the spacecrafts precise landing after years of navigating in space. By the way, Mars rovers were using celestial navigation for their ground operations long before the nav-sats started orbiting Mars. They still do actually, as the MGPS constellation is not thick enough yet.