There is hadith about attackin on pagan women and child. I want to know what was their(women and child) guilt. and the reference is Saheeh Bukhari Volume 004, Book 052, Hadith Number 256.

(Narated By As-Sab bin Jaththama : The Prophet passed by me at a place called Al-Abwa or Waddan, and was asked whether it was permissible to attack the pagan warriors at night with the probability of exposing their women and children to danger. The Prophet replied, “They (i.e. women and children) are from them (i.e. pagans).” I also heard the Prophet saying, “The institution of Hima is invalid except for Allah and His Apostle.”)

Praise
be to Allah

Firstly:

It is not permissible to deliberately kill women and children
in war, because of a great deal of well-known evidence, including the
following:

The report narrated by al-Bukhaari (3015) and Muslim (1744)
from Ibn ‘Umar (may Allah be pleased with him) who said: A woman was found
slain during one of the campaigns of the Messenger of Allah (blessings and
peace of Allah be upon him), and the Messenger of Allah (blessings and peace
of Allah be upon him) forbade the killing of women and children.

Muslim (1731) narrated that Buraydah said: When the Messenger
of Allah (blessings and peace of Allah be upon him) appointed commanders for
an army or expedition, he would advise them personally to fear Allah, may He
be exalted, and to be good to those of the Muslims who were under their
command. Then he said: “Fight in the name of Allah, for the sake of Allah.
Fight those who disbelieve in Allah. Fight but do not steal from the war
booty, do not break your promises, do not mutilate (the enemy dead) and do
not kill children…”

According to a report narrated by al-Bayhaqi in as-Sunan
al-Kubra
(17934): “Do not kill children or women or old men.”

It was narrated by Ahmad (15992) and Abu Dawood (2669) that
Rabaah ibn ar-Rabee‘ said: We were with the Messenger of Allah (blessings
and peace of Allah be upon him) on a campaign, and he saw the people
gathered around something, so he sent a man, telling him: “Go and see what
these people are gathered around.” The man came back and said: (They are
gathered) around a woman who has been slain. He said: “Such a one could not
have been involved in the fighting.” Khaalid ibn al-Waleed was in command of
the vanguard, so he sent a man, saying to him: “Tell Khaalid: do not kill
any woman or hired worker.”

Classed as saheeh by al-Albaani in
Saheeh Abi Dawood

This is the established principle: that it is not permissible
to deliberately kill women and children, unless they are involved in the
fighting, because a woman may be a fighter.

An-Nawawi (may Allah have mercy on him) said: The scholars
are unanimously agreed that this hadith is to be followed and that it is
prohibited to kill women and children if they are not involved in the
fighting. But if they are involved in the fighting, then the majority of
scholars said that they may be killed.

End quote from Sharh Muslim (12/48)

Secondly:

In war there may be a need to bombard a stronghold or a city,
or to attack at night, in which case women or children may be killed
accidentally. In this case it may be said that they are among the enemy; in
other words, there is nothing wrong with that in this situation, but this
does not mean that it is permissible to kill them deliberately.

It is on this basis that we may interpret the hadith of
as-Sa‘b ibn Jaththaamah which is mentioned in the question.

Al-Bukhaari (3012) and Muslim (1745) narrated that as-Sa‘b
ibn Jaththaamah (may Allah be pleased with him) said: The Prophet (blessings
and peace of Allah be upon him) passed by me in al-Abwa’ or in Waddaan and
was asked about night raids against the mushrikeen in which some of their
women and children might be killed. He said: “They are of them.”

What is meant by night raids is when they are attacked at
night, and it is not possible to distinguish between men, women or children.

An-Nawawi (may Allah have mercy on him) said: They are of
their fathers, i.e., there is nothing wrong with that, because the rulings
that apply to their fathers also apply to them in terms of inheritance,
marriage, qisaas (retaliatory punishments), diyaat (blood money) and so on.

What is meant is provided that they are not targeted
deliberately.

With regard to the previous hadith which speaks of the
prohibition on killing women and children, what is meant is if they can be
distinguished (from fighting men).

End quote from Sharh Saheeh Muslim (12/49)

Al-Haafiz Ibn Hajar (may Allah have mercy on him) said: The
words “They are of them” mean: with regard to the ruling in that situation.
It does not mean that it is permissible to kill them deliberately; rather
what it means is that if it is not possible to reach the fathers except by
striking the children too, so they are stuck because of their being among
them, then it is permissible to kill them.

End quote from Fath al-Baari (6/147)

Thus it is clear that it is not permissible to deliberately
kill women and children, but if the attack happens at night, for example,
and they are killed without being deliberately targeted, then there is no
blame attached to that, because this comes under the heading of the
necessities of war.

And Allah knows best.