Yeast infections are not contagious, they most likely got the infection through an underlying health condition or trapped moisture on their body. They cannot transfer the infection to you or another dog, so feel free to treat it properly and efficiently without hesitating that you might catch it.