The Quran says that every animal on earth and every bird flying on two wings is a community like humans, that nothing has been neglected in the Book, and that to their Lord they will be gathered. It also speaks of the wild animals being herded together on that day. The Prophet ﷺ said that rights will be paid to their owners on the Day of Resurrection, even to the point that the hornless sheep will be given its right against the horned one.
Beyond that, the Quran and the two most trusted hadith collections, Bukhari and Muslim, do not say what becomes of animals afterwards, and scholars have said different things: some that animals return to dust after the settling of accounts, others that the matter is left to Allah. A Muslim can say honestly that we do not know, and that we trust that Allah is just and that no creature will be wronged. For a person who is grieving a pet, this can be a comfort: Allah is just, and the hadith below show that kindness to a creature is never lost with Him.
What the sources do show clearly is how seriously Islam takes the way animals are treated in this life. The Prophet ﷺ told of a man whom Allah forgave because he gave water to a thirsty dog, and when the Companions asked if there is reward in kindness to animals, he said that there is a reward in every living creature. He also told of a woman who entered Hell because of a cat she shut in until it died, without feeding it or letting it feed itself.