Help please

I was on depo shot a year and half and now I have been off of it 2 years and been try to get preguant like 6 months and I went to doctor and they want give medician and said they would give me a shot today and next day go back and get another shot do anyone know why are the shots for.. Please I need help.