Some animals don't make the distinction IRL, and mate even if there is an unrelated female there. We don't as humans because of the genetic weaknesses it causes, which in turn led to the social stigma against it across most human cultures.
Sometimes there are evolutionary adaptations that reduce the effect genetic inbreeding has on a population.
In fact, there's a species of Ant (Black Crazy Ants, if I remember correctly) that is actually immune to genetic weakness from inbreeding, which is the primary reason they spread to every continent. A queen can mate with her siblings or children to make more colonies; thus, a single queen is all it takes for them to become endemic.