Recently I had an interview but I was not selected at that firm. After a few days, the employee from that firm who referred me asked me if there are any developers with a certain amount of experience at my current firm looking for a new job whom I can refer to him. He also mentioned the salary for the role.
Given that I currently work here and my company, like others, is in need of qualified and experienced developers should I be helping the other company poach employees from my current company?
I partially disagree with @fraxinus and Gh0stFish's answers. While you don't want to refer people who aren't looking for a new job, or are in the mildly disgruntled "I should try and find something better" state; if you know someone definitely is - not might - going to be leaving it's different.
I've had coworkers who were moving for personal reasons and doing jobs at my employer at the time which couldn't be done remotely. They were going to be gone no matter what so helping them wouldn't hurt our current employer. Both were also very open about the whole situation; and had their managers actively helping them look for new jobs. Another similar case would be if it was publicly known that someone was part of a group that was going to be let go when their current project/customer contract/etc was finished.
In any event, you should give the recruiters information to your coworker not the other way around.
The only (partially) legitimate reason is if you want a particular employee pretty much out of your company.
We all know that people of zero or negative usefulness, but boasting a rich CVs do exist. It may happen that some of them share a payroll (and duties) with you. It may even be that the management wants them gone but can't afford or doesn't care enough to fire them.
Of course, this implies you know enough office politics in the first place. I never do, but your mileage may vary.
I fully agree with the top answer that says this is stupid, dangerous and counter productive. You would, for no reason, be doing them a huge favor, hurting the company you actually work for.
"I interviewed elsewhere, and failed" is something I would keep very very silent. Both for the perceived "oh he is going to jump ship" and also the "he is not worth his salt". As far as your workplace goes, this interview did not happen. This makes the unwise recruitment even less wise.
If you have coworkers that are close enough friends that you talk about the interview to anyway (careful about that), possibly over beers, then it is another matter. I might mention that they were still looking, not hype/endorse/sell the place I failed at in any way, but just state the facts.