After they all jump into the trash compactor, I believe Han makes a comment that kind of makes it seem he didn't know where they'd end up after jumping through.
So did they know they'd end up in the compactor?
At least Leia was aware of what it was:
“Somebody has to save our skins!” she shouted, fire in her eyes. She gestured toward the hole she’d created. “Into the garbage chute, fly boy!”
The Princess, the Scoundrel, and the Farm Boy
It’s not clear whether she knew that there was a trash compactor at the bottom. It seems likely, though: she probably has a general idea of what happens to waste on spaceships. Even if she did, she couldn’t have known which trash compactor, since (according to Star Wars: Complete Locations), the garbage chute had an automatic sorting system that decided to place Leia, Luke, and Han into the recyclables bin.
Of course, given how many things were sitting in there uncompacted, it wouldn’t have been unreasonable to suppose that the trash compactor wouldn’t necessarily activate while they were in there; regardless, the risk was presumably greater than certain death at the hands of stormtroopers.