Children in a divorce situation feel like they have no control. They feel like their world has fallen apart and there is nothing they can do to fix it. A child that young has very little he feels he can be in control of, and unfortunately, bathroom habits are one of those things that only he can be in charge of. He's probably scared and angry about the changes but doesn't have words to talk about it. So he's controlling the one thing he knows how to.
If you can try to keep your cool when he does it and help him find words to describe what he's going through that will help. Make him help clean up all the messes of course, and use an appropriate consequence to let him know he needs to use the toilet.
But recognize the connection between his behavior and what is happening in his family. In most families, the mother is the primary caregiver, and he is at an age when separation can be hard even under the best circumstances. It was probably really scary for him to be away from you for a weekend. First overnighters away from Mom are hard even when there is not a divorce going on. Kids his age are too young to understand the dynamics behind the divorce, but usually feel a sense of abandonment instead. He is probably acting up more with you than with his father because he feels safest with you.
If you can continually reassure him that even though you are divorcing he will always have his mother and you'll always be there for him, that will help. Make sure he knows that you love him despite the messes he makes, and that you have confidence he'll start using his toilet again soon. If he continues to act that way, don't feel guilty about going back to pull-ups or diapers if you need to. Try not to shame him but help him find other things he can be in control of. Give him lots of choices on things that don't really matter (like which shirt he wants to wear, or if he wants to brush teeth first or wash face first, etc.)
Reassure, reassure, reassure that even when he goes away for the weekend, he will get to come back and that both his parents love him and will keep him safe. Try to find time to give him a lot of attention when he isn't "being creative" with his poop, as hard as that is when you are a single parent. It's really important that you get support for yourself too, so you can have the energy and strength to deal with all this.
Kids respond differently to divorce depending on their own developmental stage. But I can't emphasize enough: for a child your son's age, the biggest feelings associated with divorce are usually fear, concern about loss of caregivers, feeling unsupported and abandoned. A child your son's age worries that he won't have anyone to help him when he needs help, and often takes absences of one parent (when on visitations with the other) as rejection of him. He needs to be told again and again and again that he will continue to have the nuturing support of both his parents and that whatever changes he goes through, he will still have the basics of love and support.
Instead of trying to get your ex-husband to send his girlfriend away, talk to your ex-husband about maintaining the exact same routine at his house as your son is used to at home. If he can have the same type of PJs, similar type meals, same daily activities and bedtime routine, same songs, etc. that will work wonders to helping your son feel secure with the new situation. And he's less likely to act out then.
Just my two-cents as a child of divorce. I wish you healing and strength as you face this and work to support your kids as well.