Abid asked: why is that the hadd punishment of rajm applies to adultery with a free woman but does not apply to adultery with a captive woman in which case the punishment is left to the discretion of the ruler. What are the reasons for this?
Answer: If you mean by captive woman a female slave, then the answer is that her punishment is not left to the ruler's discretion, but is 50 lashes if there is no dubiousness involved (see below). It is mentioned in the Quran that the slave takes half the punishment, and since stoning can't be halved then it must be 50 lashes out of the 100 due for the free. The reason the scholars mentioned is that she is not showing the thanklessness that a free woman shows by doing the same - because of her state as a slave.
However, stoning, as opposed to lashing, has other conditions than just being free and accountable. The person that is stoned is the accountable, free (i.e. not a slave) muslim who had intercourse with another accountable, free muslim in a correct marriage while both were in this state. If such a person commits adultery after that, and this is established by the court according to the conditions for establishing it (such as there being 4 trustworthy male witnesses, no dubiosity, etc.), then he or she is stoned.
If you mean by captive woman a female slave that is part of the booty after war, and one of the soldiers had intercourse with her before the booty was divided, then there is no hadd punishment, because it has dubiosity (likeness) of ownership; he has a right to the booty. Dubiosity of ownership cancels the hadd punishment of adultery/fornication, because of the hadith "prevent hadd punishment by dubiosity." The hanafi scholars defined three types of dubiosity: 1. of ownership 2. of action 3. of contract.
Examples of the first include the captive slave woman for the soldier; the female slave of the son for his father or father's father; the woman that was divorced through figurative speech with the intention of 3 times (not actually saying the number) and is still in her 3iddah for her husband; etc. In these cases there is no hadd, even if the adulterer admitted that he knew it was forbidden.
Examples of the second include the female slave of the father for the son; the woman that was explicitly divorced 3 times and is still in her 3iddah for her husband; etc. In these cases there is no hadd if at least one of the two claimed not to have known it to be forbidden.
Examples of the third include someone who made a marriage contract with his wife's sister (and then slept with her)or made a marriage contract without witnesses (and slept with her). In these cases there is punishment if they knew it was forbidden, but not hadd punishment.
...and Allah knows best.