Depends on the type of antibiotics, most are ok to breastfeed while taking. Sometimes doctor can be overly cautious. You can search the name of the antibiotic here to see if it's safe for breastfeeding https://toxnet.nlm.nih.gov/newtoxnet/lactmed.htm
Suggest to take doctor’s advice. Think the doctor does not want baby to get fed breast milk with the antibiotics.