Its best not to worry about continuity in the Bond movies (for example, his dead wife, which has been referenced all of 2 times in the 37 years since OHMSS). In the books, he (M) was a man, a former Navy Admiral, and he had more of a personal relationship with Bond then the movies ever showed. He was more like a boss/mentor.
M is a woman simply because its Judi Dench, and they wanted to keep a recognizable and famous face around.