I found this online that seems to say both yes its safe and not it might not be, so not much help. There are some antibiotics that are considered safe to use during pregnancy if you are worried about this one, maybe you could try one of the others. I'm sure your doctor weighed the pros and cons and thought it would be best.
Cephalexin Pregnancy Warnings
Cephalexin crosses the human placenta. In one study of 30 pregnant women who were given cephalexin 1 gram orally once, the average peak umbilical cord and amniotic drug levels were 11.3 (four hours after dosing) and 13.2 mcg/mL (six hours after dosing), respectively. The Michigan Medicaid surveillance study showed a possible association between cephalexin and congenital defects. This report is a summary of information from two studies, one in which 1,705 of 104,000 pregnant women from 1980 to 1983, and one in which 3,613 of 229,000 pregnant women from 1985 to 1992 received cephalexin. In the first study, 127 total defects and 19 cardiovascular defects were observed (122 and 16 were expected, respectively). In the second study, 176 total defects were observed (154 expected), of which 44 were cardiovascular in nature (36 expected). Cleft palate was observed once in the first study and 11 times in the second. These data support an association between cephalexin and congenital defects, although other causes, such as the underlying disease(s) of the mother and concomitant drug therapy are unaccounted for.
Cephalexin has been assigned to pregnancy category B by the FDA. Animal studies have failed to reveal evidence of fetotoxicity or teratogenicity. There are no controlled data in human pregnancy. However, the drug has been used in various stages of pregnancy without evidence of fetal harm. Cephalexin should only be given during pregnancy when need has been clearly established.