They don't; they "tie" during mating. The male mounts the female and when he's fully inside, the glands in the sides of his penis expand and hold him there, sometimes for as long as a half hour. Often he'll drop his forelegs back to the ground and swing one hind leg over the female's back, so that they stand, butt-to-butt, for some time.
There is some speculation that one of the reasons for this odd behavior is that it makes it impossible for the rest of the pack to miss who the alpha male has mated with. Dogs have no sense of privacy! ;) But it also makes it more difficult for other males to mate, since if the alpha male or female found another pair tied, they would attack. The adrenalin rush of the attack would help end the tie, but the mating dogs would be at a disadvantage and would be soundly trounced by their leaders for illegal behavior in the pack.