The teams did indeed have female players, but they were non-canon
The mentioned female members of the Hufflepuff team were:
- Maxine O'Flaherty
- Heidi Macavoy
- Tamsin Applebee
The mentioned female members of the Slytherin team were:
- Lucinda Talkalot
- Emma Vanity
- Jody Jackknife
- Jo King (possibly)
- Winky Crocket (possibly)
None of these individuals is from book canon. They all hail either from information in the films, or from the video games.
Some national teams seemed to have many female players
The Irish team, for example, had Moran and Mullet, which at two players out of seven is more-or-less consistent with a fair selection process.
Mullet:
As Mullet shot toward the goal posts yet again, clutching the Quaffle
tightly under her arm, the Bulgarian Keeper, Zograf, flew out to meet
her.
—Harry Potter and the Goblet of Fire
Moran:
Dimitrov shot straight at Moran, who had the Quaffle, nearly knocking
her off her broom.
—Harry Potter and the Goblet of Fire
This is book canon. We therefore can suppose that Quidditch is fairly equitable in general.
So why aren't there female players on the Hufflepuff or Slytherin teams in canon?
With Hufflepuff, sufficiently few members were mentioned in canon that we cannot reach much of a conclusion about the gender makeup of their team. Specifically, we only know of:
- Cedric Diggory (whose death was a tragic accident)
- Summerby
- Zacharias Smith
- Cadwallader
A Quidditch team has seven members, and these players are present at different times, so we just don't have enough information.
With Slytherin, things are different. We know a rather large number of their players, and they are all male. In light of the rather severe degree of prejudice shown by many Slytherin students, this would not be particularly surprising, but the prejudice of the wizarding world is primarily against Muggles, Muggle-borns, and non-human magical creatures. Wizarding Britain, at least, had far more gender equality than its non-magical counterpart—for example, Artemisia Lufkin was elected Minister for Magic in 1798.
Out of universe, one can speculate. Perhaps JKR saw the Slytherin team as largely interchangeable, so it was "Draco plus a bunch of random muscle-bound lackeys."
But in-universe, why would this be the case? I think even Slytherin house would not have been particularly sexist, given the prevailing attitudes of the wizarding world.
I can think of three possibilities, but they are largely speculative.
The Slytherin captain for most of that period, Marcus Flint, may have been particularly misogynistic himself. Thus, despite prevailing attitudes in wizarding Britain, he may have excluded female players from his team.
Flint may have preferred the largest players for whatever (poor) strategy he was using, which led him to select only male players.
Although JKR only mentioned male players, because in her view the Slytherins were generally interchangeable, we can invoke God of the Gaps and say that the players she didn't mention were female (as the films seem to have done).