He had used such a gun during the Second World War when he was in Naval Intelligence and felt it was an appropriate sidearm for a secret agent on an undercover mission. So when he introduced, Bond as using a Beretta 418 in a flat chamois leather holster he probably didn't think too much about it.
When Ian Fleming wrote the first of the James Bond novels, Casino Royale, he had no idea the direction in which the stories would go, let alone how many he would eventually write.