Unnecessary medication is not advisable once you start trying for a baby (in fact, even before that!).
However, if you suffer from any long-standing illness like epilepsy or diabetes, you must consult your doctor before trying to conceive. The doctor may need to adjust your dosage or even change the treatment so that the drugs are not harmful for the baby, if you become pregnant.
However, do remember that if you are taking any medication that has been prescribed by your doctor, you must continue taking it unless advised against it. You may be endangering your and your unborn baby's life unknowingly if you stop taking the medication.
If the doctor feels that the benefits of taking the medication outweigh the risks, then he/she may advise you to continue the medication for some time, or even for the entire duration of your pregnancy.
Always consult your doctor before starting a new medicine or stopping any medication once you start trying for a baby.