Fertility medication and being overweight

If you are overweight/fat will fertility medication still work for you and help you get pregnant? Or do you have to lose weight in order for it to work?