Can I get pregnant if I have unprotected sex and he came in me 4 days before ovulation and one day after ovulation?

Yes. Normal sperm can live up to 5 days in the female reproductive tract. So intercourse 4 days prior to ovulation could result in pregnancy. The chance of pregnancy is highest when intercourse takes place on the day of ovulation or the day before.