Media playback is not supported on this device
It was the seventh time Britain have been fourth in a Rio swimming final.
"It was anyone's for the taking but I just couldn't get my hand on the wall quick enough," said Halsall, 26.
Denmark's Blume clocked 24.07 seconds to finish ahead of American Simone Manuel (24.09) and Aliaksandra Herasimenia of Belarus (24.11).
It is Denmark's first swimming gold medal since the London 1948 Games.
At 1.71 metres tall, Blume briefly gave up the sport after being told she was not tall enough to succeed in her favourite event.
"I enjoy swimming the 50m free, it's so much fun, but I'd always been told I'm too small and I should probably be a 200m swimmer," Blume said.
"So I had to take a break and just figure out how I wanted things to go."
Defending champion Ranomi Kromowidjojo finished sixth in 24.19.
"It's disappointing not to come away with the result I wanted but I've done everything I could this season to give myself the best shot," added Halsall.
Britain's Fran Halsall finished fourth - just 0.06 seconds off gold and 0.02 off bronze - as Pernille Blume won the Olympic 50m freestyle title.