The stampede in the northern city of Mymensingh erupted when crowds of people tried to force their way into a factory compound through a small gate after massing outside before dawn, according to local police chiefs.
Television footage from the site showed scenes of utter devastation, with hundreds of torn and blood-spattered sandals abandoned at the gate of the factory, which produces chewing tobacco.
“We have so far recovered 23 bodies. Most of the dead are poor and emaciated women,” Mymensingh police chief Moinul Haque told AFP, putting the number of injured at four.
Kamrul Islam, the senior officer at a police station near the factory, said the death toll was likely to rise further while local media said scores of people had also been injured.
“Some people had taken the bodies of their relatives before police arrived at the scene,” Islam said.
The owner of the factory and six other people have been arrested for failing to ensure public safety, Islam added.
Police said up to 1,500 people had massed outside the factory at around 4:45 after the owners had announced they would distribute free clothes to poor people in accordance with Islamic ritual.
Rich Bangladeshis often distribute free clothes to poor people during the Muslim holy month of Ramazan, which began on June 19.
But the handouts have sparked several deadly stampedes over the years.
Around 40 people were killed in a similar stampede at a garment factory in the northern city Tangail in 2002.
Factory safety has been a major issue in Bangladesh since the collapse of a clothing manufacturing complex in April 2013 that left more than 1,100 people dead, making it one of the worst industrial accidents in history.