It was necessary, that information in the books is only got across through Catelyn's inner thoughts, and you can't have that in the TV series. Someone had to say it aloud, it may as well have been Littlefinger.
It was necessary to convey the backstory but it wasn't necessary for them to do it like that. The possibilities were endless. A conversation between Catelyn and Ned, for example. Or a conversation between Catelyn and Lysa
, for maximum foreshadowing.
But that scene did more than just give us important information about Petyr's backstory, it also had him announce his plans for no reason. That's incredibly foolish. I mean, just off the top of my head:
-One of the prostitutes could have betrayed him. Roz, I think she's called, has only just arrived from the North and he's trusting her with this information already? Why?
-One of Varys' little birds could be listening. In the books at least (and I suspect this will be confirmed in upcoming episodes of the show) there are secret passageways in and out of many such establishments.
-Varys himself could be listening. He is able to get in and out of various brothels at his leisure, as we've seen in the books, and can disguise himself effectively. We've not seen him wear a disguise on TV like he has in the books but it's been established that he was a former mummer.
-Cersei is not oblivious to what goes on in the brothels, either though her intel isn't always perfect. This is also drawing on information from the books but she was able to find out about Shae, for example, albeit arresting the wrong woman in the process.
Littlefinger uses the brothels to get useful information out of the various important figures who frequent them. He knows that saying something in a brothel - even when he owns it - is equivalent to telling half of King's Landing.