Diving and photography is multitasking. Best that the diving be well under control, feeling automatic -- especially buoyancy -- and with good situational awareness, before bringing a camera with you. As all the responses above have said, get comfortable -- really comfortable -- with the diving, and then maybe take a camera. But, no matter how good and how common this advice is, nobody seems to listen. Once you start diving, just look around at the clusterf*** of newish divers and the mess they make of the environment they are in and the bumping into the people around them. Give them a camera and it gets even worse.
As for how many dives or certs....no way to tell. It is up to you. Maybe right away, maybe never. As a wild guess, I'd say 100 dives in varying conditions. I'd rather -- for your sake and for the sake of the environment and your buddies -- that you never take a camera than you take one too soon.
I won't teach an underwater photography course to someone until I've had two dives with them. On the first dive I just watch them and calibrate them when they are totally focused on their diving. On the second dive I give them a 1-pound weight to hold and tell them that is their camera, and to use it to take "pictures" of anything they see...by holding it near a moray or pointed up toward the boat in mid-water, and see if their diving skills (especially buoyancy) dissipate when they are focused on something else. I end up telling most people they are not ready for a distraction; get some more practice just diving.