can I leave state with my child?

so I'm young and 20 weeks pregnant. I recently decide to leave my boyfriend who is a low life and likes to mentally abuse me, since I've been pregnant he stopped being physical. he says he will take my baby away from me. I'm not giving the baby his last name ( which he says the courts will change it to his last name ) and I'm thinking about leaving state nowish In fear he will take me to court, I do want him there when our child is born and around sometimes just not all the time and I don't want him to have any custody and if i had to go to court over custody id be terrified at the idea of losing my child even if there is a 1% chance he could win, I don't like it. can I leave state with my child legally?