I never had sex can I still get pregnant? Does pregnancy only occur by having sex?

No. You don't have to have sex to get pregnant. You can be inseminated by a donor's sperm. You can also have fertlization in vitro (meaning that your egg cell will be taken from you and a sperm cell will meet it in a vial. Once coupled a fetus will be formed and then it will be placed in you). I would, however, not go those routs until you try and fail to do it naturally.