I had the exact same problem with my Nikon AF-S VR Micro-NIKKOR 105mm F/2.8G IF-ED. I was diving in Fiji and had this happen on several occasions. Including a night dive with ripping current. It was super annoying and frustrating. Out of the water and housing I could never replicate it. I tried multiple times and it always worked perfectly. I cleaned the contacts on the lens, body, etc. I don't recall if I tried a factory reset on the body, but that could not hurt too much to try.
I just bought another copy of the lens and sold the old one. The problem was not worth the gray hairs.