Praise be to Allah.
Undoubtedly the concepts and ideas that a child learns about and experiences in the early stages of his upbringing will have an impact on him for much longer than the parents and teachers of the child themselves realise, and that does not go away once that stage is passed; rather they will remain and form an important part of his make-up and thinking, and will have a clear impact on the formation of his identity and culture.
In Saheeh al-Bukhaari (6130) and Muslim (2440) it is narrated that ‘Aa’ishah (may Allah be pleased with her) said: I used to play with dolls in the house of the Prophet (blessings and peace of Allah be upon him), and I had friends who would play with me, and when the Messenger of Allah (blessings and peace of Allah be upon him) came in, they would hide away from him, but he would send them one after another to play with me.
The scholars stated that Islam only granted a concession to children to play with such toys, even though it forbids images and the making of images, because of the role that playing with such toys plays in preparing the child mentally for what he will do in the future.
Al-Haafiz Ibn Hajar (may Allah have mercy on him) said:
An exception is made for this from the prohibition on keeping images. This was stated definitively by ‘Iyaad and was narrated from the majority. They regarded it as permissible to sell toys to girls to train them from an early age in caring for their houses and children.
End quote from Fath al-Baari, 10/527
Undoubtedly the pig is not only an impure animal or something that is haraam to eat, or other things that are said about it or other Islamic rulings that have to do with it; it is also a cultural element of the Christian West, and part of the identity of those nations.
In Saheeh al-Bukhaari (2222) and Saheeh Muslim (155), it is narrated that Abu Hurayrah (may Allah be pleased with him) said: The Messenger of Allah (blessings and peace of Allah be upon him) said: “By the One in Whose hand is my soul, soon the Son of Maryam) will descend among you as a just judge, he will break the cross, kill the pigs and abolish the jizyah, and wealth will become so abundant that no one will accept it.”
Ibn Battaal (may Allah have mercy on him) said:
The reason for breaking the cross and killing the pigs is because they are part of the religion of the Christians who are fabricators and transgressors. Hence the Prophet told us that ‘Eesa will change what they attributed to him, as Muhammad changed it and told them that they were following falsehood in that regard. This indicates that ‘Eesa will come to confirm the corrections introduced by the law of Muhammad, and will judge with justice between people.
End quote from Sharh Saheeh al-Bukhaari, by Ibn Battaal, 6/604
An-Nawawi (may Allah have mercy on him) said:
This indicates we should object to evil deeds and remove them, and remove the symbols of evil, and killing the pigs comes under this heading. It is also indicative of the view favoured by our madhhab and that of the majority, which is that if we find a pig in non-Muslim lands or elsewhere, and we are able to kill it, we should kill it; and it proves false the odd opinion held by some of our companions and others, who said that pigs should be left alone if they are not causing any harm.
End quote from Sharh Muslim, 11/221
To sum up:
Pigs are an animal that is not respected, and one of the symbols of disbelief and lies against Allah, may He be exalted. So it is not right for a Muslim to raise his children to like them or pay attention to them or be fond of them, whether that is in a picture book or a toy or a cartoon and so on. Rather what is prescribed is to point out that they are connected to their false religion and are one of its symbols, and that they have no protection or sanctity in sharee‘ah, and we should explain that according to the child’s level of understanding, so that when he grows up, he will have a proper understanding of the shar‘i rulings having to do with them.
With regard to making your children avoid seeing pigs, if what is meant by that is a passing glance or seeing a picture of a pig in passing, this is something that is difficult to do, and we do not think that it is necessary. Rather all that is required is that the child should not become used to them or care about them or pay any attention to them.
And Allah knows best.