In German, the choice of the possessive article in the third person (sein, ihr) depends on the gender of the noun it is referring to. In your examples, the possessive articles refer back to the subject and the gender of the noun is clearly indicated by the forms of the definite article (der, die).
Die Katze trinkt ihr Wasser. (feminine)
Der Hund trinkt sein Wasser. (masculine)
Note that sein can also refer to neuter nouns.
Das Huhn trinkt sein Wasser. (neuter)
However, the ending of the possessive article depends on the noun that follows it.
Die Katze mag ihren Kratzbaum und der Hund mag seinen Knochen. (accusative masculine)
Die Katze sucht ihre Beute und der Hund sucht seine Beute. (feminine)