I am a submarine officer (who is now applying to medical school), and my wife is a fourth year Ob/Gyn resident. We have had no issues with co-location thus far. I think you have some flexibility here. If you are interested in Undersea Medicine, the Squadron Medical Officers referred to in the previous post are UMOs. Having interacted with several of them, I know their billets are not particularly exciting (think lots of physicals and screenings). If I were you, I would find the specialty that you are interested in, and determine how many billets are available at the naval hospitals near submarine bases. With the exception of Groton (not too many billets at the hospital) and Pearl Harbor (Tripler is an Army Hospital, and therefore can be difficult to obtain a billet), the other sub bases should be easy locations at which you can co-locate.
Hope this helps...please PM me if you have any other questions I can attempt to answer!