I have been married for over 2 years and until now my wife has not become pregnant, this is not a worry for me particularly but my wife gets upset and after much pressure I have agreed to go to the doctor, not an issue but after this I expect that he will arrange an appointment at the hospital to complete a check up which will require a sample of my sperm. What is the ruling on this? And what advice can you give me?
All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger. We ask Allaah to exalt his mention as well as that of his family and all his companions.
There is no harm for undergoing a medical check up as mentioned in the question provided the doctor does not reveal your 'Awrah (parts of the body that must be covered in Islam) without a necessity. As regards giving him a sample of your sperm in a tube or container so that he would carry out a test on it then there is no harm in this. This falls under what is called seeking treatment and the Prophet said: "Indeed Allaah has not sent down any illness without sending a cure for it, so seek treatment but do not treat yourselves with what is impermissible." [At-Tabaraani]
Extracting sperm should be done only in an Islamicly permissible means, which is through a sexual intercourse with your wife.
Allaah Knows best.
You can search for fatwa through many choices