This is a film thing really. In the books nobody is sent to the dungeons, they're evacuated.
'... evacuation will be overseen by Mr Filch and Madam Pomfrey. Prefects, when I give the word, you will organise your house and take your charges, in an orderly fashion, to the evacuation point.'
Harry Potter and the Deathly Hallows - p.489 - Bloomsbury - Chapter 31, The Battle of Hogwarts
It is expected that most people will evacuate, but not everyone is required to leave.
[...] Ernie Macmillan stood up at the Hufflepuff table and shouted, 'And what if we want to stay and fight?'
There was a smattering of applause.
'If you are of age, you may stay,' said Professor McGonagall.
Ibid.
Now, it is not at all clear that the whole of Slytherin is ordered to evacuate either.
'Thank you, Miss Parkinson,' said Professor McGonagall in a clipped voice. 'You will leave the Hall first with Mr Filch. If the rest of your house could follow.'
Harry Potter and the Deathly Hallows - p.491 - Bloomsbury - Chapter 31, The Battle of Hogwarts
She then orders the Ravenclaws out in exactly the same terms:
'Ravenclaws, follow on!' cried Professor McGonagall.
Ibid.
So it's not obvious at all that she's requiring all Slytherins who want to stay to leave. She's ordering the students who are under-age to leave house by house and inviting those who want to evacuate to go with them. But she's not obviously ordering any brave Slytherins who want to fight to leave. Those who wanted to stay would presumably have been welcome, it's just nobody did stay.
Slowly, the four tables emptied. The Slytherin table was completely deserted, but a number of older Ravenclaws remained seated while their fellows filed out: even more Hufflepuffs stayed behind, and half of Gryffindor remained in their seats, necessitating Professor McGonagall's descent form the teachers' platform to chivvy the under-age on their way.
Ibid.
In fact, only a few pages earlier she expresses her true sentiments.
'I shall expect you and the Slytherins in the Great Hall in twenty minutes, also,' said Professor McGonagall. 'If you wish to leave with your students, we shall not stop you. But if any of you attempt to sabotage our resistance, or take up arms against us within this castle, then, Horace, we duel to kill.'
'Minerva!' he said, aghast.
'The time has come for Slytherin House to decide upon its loyalties,' interrupted Professor McGonagall. 'Go and wake your students, Horace.'
Harry Potter and the Deathly Hallows - p.484 - Bloomsbury - Chapter 30, The Sacking of Severus Snape
Obviously she very reasonably warns Slughorn (and his house) against fighting against the defenders of Hogwarts, but I think her closing remarks allow plenty of room for Slytherins to take part in the fight against Voldemort. She remarks to Horace Slughorn that she won't stop him from leaving, but she leaves the door open for him to join the fight. And although there seems to be a presumption in "[i]f you wish to leave with your students" that Slytherins will not be staying behind, I'm not too put off by that. For one thing, she goes straight to the Great Hall and orders an evacuation, permitting people who are of age to stay and fight only when asked. She cannot, as a teacher, expect her students to stay and fight and die.
Since writing the answer I've gone back and had a quick look at your question before the edit and I see you were originally asking about the movies anyway.
Well, the movies are nonsense, but putting that to one side... Out of universe it's a sarcastic joke and that may even be part of it in universe as well. A bit of humour to relieve the tension before the battle. I don't think, in-universe, the Slytherins were ever actually taken to the dungeons, McGonagall was clearly being snarky and sarcastic.
As for why the whole house were ordered out, I think more-or-less the same kind of analysis can be applied to the movies as well. The expectation is that students will go to safety, McGonagall is in loco parentis and, dangerous as daily life in Hogwarts can be (particularly with the Carrows), she cannot but expect her students to go to safety. Had some brave, of-age Slytherin said, 'I want to fight with you Professor,' I think she would have agreed.
Of course, a final, very plausible analysis is that she's simply seen the behaviour of the Slytherins under Snape and the Carrows and wants them out of Hogwarts. In the books, for example, Crabbe and Goyle love using the Cruciatus Curse on people:
'Amycus, the bloke, he teaches what used to be Defence Against the Dark Arts, except now it's just the Dark Arts. We're supposed to practise the Cruciatus Curse on people who've earned detentions -'
[...]
'[...] Some people are into it, though; Crabbe and Goyle love it. First time they've ever been top in anything, I expect.'
Harry Potter and the Deathly Hallows - p.462 - Bloomsbury - Chapter 29, The Lost Diadem
Perhaps the general is just being prudent. You know what they say, the barbarians never take a city until someone holds the gates open to them.