There is still a very widespread misconception (that has already provided many a baby with a little brother or sister) that women can't get pregnant while breastfeeding, also known as nursing. Breastfeeding does actually have an inhibitory effect on fertility/ovulation. But it is only possible with hindsight for a nursing mother to know for sure whether or not she has ovulated, i.e. when she has her first period.
And once solids are introduced (when you start to give your baby other foods in addition to breast milk), there is an increased likelihood of you starting to ovulate again, with a return to fertility. If you don't wish to take any risks, then you should also use contraception while breastfeeding. Your gynecologist will tell you which methods of contraception are appropriate for you.