Why has Israel imprisoned so many children?
If you asked a class of 18 year-olds to think analytically about this, and leave their emotions out of it, what answers would you get?
To stop them immediately from doing what they're doing.
To stop them from doing it again tomorrow.
To remove them from parents who are egging them on.
Because they want to frighten the children into not doing it again.
Because some of the soldiers want to posture and swagger and enjoy intimidating.
(Do I think that Israeli soldiers are the only ones who have ever behaved like this and the British couldn't possibly? Er, no. All that testosterone in uniform with a military weapon to hand....).
Because it will cost the country to keep them in prison but they will be a useful bargaining power in the future, if need be, especially if you live in a country which is attacked now and again. If you've got detainees of any kind, they might become useful pawns in the bargain.
There will be loads of other answers too.
You say that you find it hard to believe that thousands of imprisoned women are members of Hamas. Do you think it's possible that SOME of those women are members of Hamas or sympathisers of Hamas?
I am not trying to be an apologist for anyone but I don't see any of it as 100% anything, 'all innocent or or guilty' for instance, and I try, sometimes, to step away and think what reasons any of them have for what they do.
Edited to add this paragraph.