I have encountered a pun in a novel by Terry Pratchett that I cannot wrap my head around. I'm not a native English speaker, and any assistance with this would be highly appreciated. The pun seems to have nothing to do with the story and everything to do with the English language, which is why I'm asking here.
To give context for the pun, I have to give a light spoiler for Jingo, directly, and Men at Arms, indirectly, from the Discworld series of novels, so skip this post if you're planning on reading either novel.
At one early point in Jingo, two main characters, Carrot and Angua, visit a room rented by a landlady. The landlady mentions that no pets or women are allowed on the premises. While alone in the room, the below exchange takes place between Carrot, a human male, and Angua, a female werewolf:
"Carrot? Why are we whispering?"
"No wimmin, remember?"
"And no pets," said Angua. "So she's got me coming and going. Don't look like that," she added, whens she saw his face. "It's only bad taste if someone else says it. I'm allowed."
I can tell from context that "coming and going" is some kind of pun, and possibly a lewd one, but I cannot figure out what the word play is based on. Is it an existing English phrase that's being reused with a different meaning, because of Angua being a werewolf?