I've heard people doing it in residency but I waited until I was out. It would have been really tough for me to give it enough time and attention with the kind of hours I was working then, unless I had a SO at home. If it's a puppy, forget about it.
If you have the funds to hire a dog walker or sitter that could come by while you are at work (or doggie daycare), then sure... probably doable.
I absolutely love my dog and most of the time would wholeheartedly encourage getting one but just make sure you've got time to properly take care of the animal. You're going to be gone from home a lot during residency and studying a lot. If it's a puppy, they require an enormous amount of attention and socialization.
If you are married or have an SO at home then that changes things and I would say it's very doable in that case.