Is it OK to hire another lab's student?
Consider the following scenario: 


  I've been working with a professor for a year now, and at one of his
  events, I presented a poster. Another professor came up to me and
  started talking, and it turned out that this professor had a very
  interesting project related to my interests. I'm applying to grad
  schools in a year, and if I can get two recommendations from faculty
  it will really help my application. Should I work with this professor
  or not ?


Students have agency too. There's a lot of context and background missing in your description that Koldito alludes to. But in general students should be free to make their own decisions about their research activities and honor existing commitments that they've agreed to. 

Personally, if I were Professor B, I might suggest that the student talk to you first before deciding, but it's also possible that B did that, and the student indicated that no continuing commitment existed. If I were advising the student, I'd also suggest they clear things up with you first. I might also suggest that depending on the level of interest in the project they have with you, they give you the right of first refusal. 

But this exact situation has happened to me with students (twice). They worked with me for a while, and then found a topic that made more sense to them with another professor. I wished I could have convinced them to stay, but they did well with their advisors and I was on both their committees, with no hard feelings at all.