There are some very bad possible reasons and some very normal possible reasons.
If she were just urinating in her pants, I would say that maybe she has a bladder infection and can't make it to the toilet.
If she had diarhea, I would say that maybe she has an intestinal infection. The urination could have been a reflexive release when the stool started coming out.
If you weren't near a toilet, I would say that she's 3 and just couldn't hold it. (I'm assuming that's not the case since you were home and not rushing in the door or anything like that.)
If she was at home and the only toilet available was being used, I would say that she's 3 and couldn't hold it.
If she was intensely engaged in an activity, there is also the possibility that she simply ignored her body's signals and waited to long to go to the bathroom, so long that she couldn't even make it to the bathroom. I've even seen 8-year-olds do that.
If none of those seem to make sense, then you need to start thinking about psychological causes. Children often lose control of such bodily functions when they are under stress. If you have a sensitive child, it may not take much to build up that level of stress (such as just getting in trouble for doing something wrong). However, there is the possibility that something more serious is going on.
Pay very close attention to her behavior and play. How does she play with dolls? How does she play with other kids? Does she say anything that doesn't seem normal? Talk to her father and find out if anything happened? Did she get in trouble? Was she playing with other kids? If so, how did those kids treat her? Was she left alone with any other kids or adults? We're there any adults who didn't treat her with respect?
Most importantly, TALK to your daughter about her trip to her dad's. Ask her about what she did, who she talked to or played with. Ask her what part was her favorite part. Ask her what part was her least favorite. Ask her if there was anything that happened that she didn't like and doesn't want to happen again. Ask her if she's looking forward to going back to dad's. Maybe it was something little. Maybe it was something big. I don't want to freak you out, but as a parent, you need to consider these possibilities.
Also, while you're at it, now would be a good time to talk to your child about how people should treat her. (3 is not too young for these conversations, no matter what people may tell you.) Talk to her about hitting, pinching, biting, pulling hair, etc. and that she doesn't deserve to be treated like that, nobody does. Talk to her about what people can and can't touch on her body, what people can and can't look at, and explain that those or very special, private body parts that are only for her, and can only be touched by mommy, daddy, caretakers, and doctors for cleaning or medical reasons, nothing else. Give her some tools to deal with situations that might come up, like "if somebody tries to touch you there, yell no and run away, tell a grown up, or call mommy" (they love to practice the yelling and running parts). "If somebody hurts you, yell no and get away from them. Go tell a grownup or call mommy." Also have her learn your phone number (we created a little song so our kids can memorize ours, they got it down in one day), and let her practicing calling your phone number every day (yes every every day) and even from various phones.