It depends on the type of animal, but with most mammals, the male can smell the changes in the female's body chemistry. Her hormone balance will be different while pregnant and she will give off different pheromones.
Well, they don't really know it but it happens. It's not like animals have a mating procedure but they do have needs as well and they go through with doing it and usually by the end of it they end up having a baby. But that barely happens. Only sometimes do they have a baby.