Yes, you probably got the yeast infection from the anal intercourse. Its very possible that he didnt cleanse himself properly before sexual intercourse with the vagina. And you can spread the infection to him, again if he doesnt properly cleanse himself. Its all about good hygiene these days.