The infection can be passed from mother to child during childbirth, through sexual contact, or by sharing needles that are used to inject drugs. 
HBV can be passed from a mother to her baby when the mother is having the baby, or through having sex, or using the same needle as someone else.  