Can you ?

So I’m curious, I’ve heard that you can only get pregnant when you’re ovulating & that you can get pregnant at any time, what’s the truth?