Hanzala al-Katib (may Allah be pleased with him) says: We were with the Messenger of Allah (peace and blessings of Allah be upon him) in a battle (war). We passed by a slain woman, and people had gathered there. (When they saw him) the people made space for him, so the Messenger of Allah (peace and blessings of Allah be upon him) said: "She was not among those who fight." (Then why was she killed?) After that, he said to a man: Go to Khalid bin Walid and tell him that the Messenger of Allah (peace and blessings of Allah be upon him) commands you not to kill women, children, laborers, and servants under any circumstances.
This chain also narrates from Rabah bin Rabee’ in the same manner. Abu Bakr bin Abi Shaybah says: Sufyan Thawri used to make a mistake in this.