There is nothing wrong with keeping animals for which there is no Islamic prohibition on keeping them (such as dogs and pigs). There are reports in the Sunnah which indicate that some of the Sahaabah kept permissible animals for farming purposes or for fun and for pleasure.
It was narrated from Anas (may Allaah be pleased with him) that he had a young brother who had a nughar (a small bird or nightingale). The bird died, and the Prophet (peace and blessings of Allaah be upon him) saw him looking sad and grieved, so he joked with him, and said to him words which implied approval of his keeping this bird. The Prophet (peace and blessings of Allaah be upon him) said to him, “O Abu Umayr, what happened to the nughayr?”
And the Prophet (peace and blessings of Allaah be upon him) told us that a woman entered Hell because of a cat “which she did not feed, neither did she let it eat from the vermin of the earth.” From this it may be understood that if she had fed it, she would have been saved from that threat.
And it was said that Abu Hurayrah was so called because of a cat (hirr, dim. hurayrah) which used to accompany him.
So keeping permissible animals, so long as you do not neglect them, is something which is permitted and it may even be one of the means of earning reward, as the Prophet (peace and blessings of Allaah be upon him) said, “In every living being there is reward.” But if you keep animals and neglect and abuse them, it may be one of the means that lead to sin and the threat of Hell, as in the hadeeth about the woman who neglected her cat until it died.
With regard to the conditions and guidelines on keeping animals, these include the following:
1. The animal that is kept should not be a dog, because Islam has forbidden keeping dogs except guard dogs and hunting dogs. The Prophet (peace and blessings of Allaah be upon him) said: “The angels do not enter a house in which there is a dog.” Narrated by al-Bukhaari (3225) and Muslim (2106). Would the Muslim be happy for the angels of mercy not to accompany him in his house because of an animal he is keeping?
2. The animal must be treated kindly. If a Muslim keeps an animal, he must provide it with proper food and drink, and not cause it any harm or injury by mistreating it or using it for target practice or making animals fight one another, or exposing it to heat or cold.
And Allaah knows best.