Yes, the offside rule states that two players from the opposition have to be between an active player and the goal. One of those players can be, and usually is, the goalkeeper.