Can I be pregnant if I got my period the day after I had sex? It lasted only 2 days

Not from day before. You can get pregnant anytime during your cycle, albeit less of a chance around the time of your menstrual flow. The chance is much higher during time of ovulation--mid cycle for most folks, but it can happen at any time. Having relation the night before and "period next day" is not likely pregnant from this relation, but maybe from 2 or more wks before. Consult doc for problems. Good luck.
MAYBE. It is possible to get pregnant whenever you have unprotected sex. You cannot count on your period being the answer. Always use protection if you do not want to be pregnant. Of course there are more obvious times for pregnancy to occur like ovulation etc but don't count on this. The issue is that sperm can survive for a while and this is what can mess you up.