Those words do not strike me as particularly poetic. The literal
meaning is that the tax collectors who were with the drummers told /
ordered the residents to pay up when the residents came out of their
homes to find out why there was so much noise. The stylistic
pattern is frequently accompanied by the word "only". This turn
of phrase is used to suggest that something unexpected happened -- some
unexpected or disappointing result.
They emerged from their homes (only) to be told to pay up.
That is, they emerged from their homes expecting to chase away or
silence the noisemakers, and -- surprise, surprise -- they found they
had been tricked into coming out of their homes so that the tax
collectors could tell them that they had to pay their taxes!
They waited in line for three hours [(only) to be told / (only) to find out] that the tickets were no longer available.
They expected to buy tickets, but -- surprise, surprise -- when they
got to the ticket window, there were no more tickets to buy!
As they were running late, they rushed to the airport, (only) to discover they had left the tickets at home!
CJ