There is no evidence thus far that dogs actually understand what is happening when two people have sex. They likely recognize the smell of pheromones when people become aroused and other scents associated with people engaging in intimacy.