If the Prophet's companions had been doing something unacceptable to Islam, God would have either revealed a prohibition in the Qur'an or the Prophet would have given an order in a Hadith. The fact is that the Prophet did not give such an order. Instead, when he learned from one of his companions that he resorted to contraception, the Prophet said clearly that no method of contraception would stop the creation of a child, should God will that the child be born. As such, no method of contraception can stop God's will being fulfilled. The method of contraception which was known at that time was coitus interruptus.
Modern methods are equally permissible, provided that they are safe and they prevent conception.
Sterilization of either the man or the woman is not permissible except when it is made absolutely necessary for medical reasons. Thus, if doctors determine that any pregnancy is likely to present a serious risk to the life of the mother, then sterilization may be approved. But each case must be considered separately on its own merits. What I have said so far applies at the individual level only. A national policy of family planning which aims to reduce the population is unacceptable because it is likely to have serious repercussion on the health of the nation as a whole.