The linguistic usages associated with household pets have been well covered in other answers, but they do not exhaust the topic.
In many cases, the sex of an animal (other than a pet) either is not known or is irrelevant. In those cases, it is idiomatic to use "it" as a pronoun. If the sex of the animal is known and relevant, then the pronoun appropriate to the animal's sex is idiomatic. "The kittens' mother was very attentive. It was continually bathing them with its tongue" is far less likely than "The kittens' mother was very attentive. She was continuously bathing them with her tongue."
Furthermore, if the animal has been specified by a noun that specifies sex, the pronoun should agree. For example, it is not idiomatic to refer to a "bull" or a "boar" as "she," nor is it idiomatic to refer to a "ewe," or a "lioness" as "he."