Before taking any medication, however, you will have to complete diagnostic tests to determine what is causing your infertility problems. Once you know the cause, medication may be directed at correcting it. Fertility Drugs that Stimulate Ovulation. This type of medication will be prescribed if you have problems getting pregnant because your periods are absent or irregular since you cannot produce or release eggs.