They might buy it because it fits a page, or balances a layout. Unfortunately, the alternative is also true. The editor might return a perfectly good poem because it doesn't match a them they're publishing, because it's too long or short to fit in their next issue, or just because they've already spent their budget. Generally speaking, you cant' get a poem published unless it's good enough. But being good enough isn't necessarily good enough.
Timing is important, too.
Subject matter matters. Even length can be a reason to turn down an otherwise perfectly good poem. So when you get one of yours back, one you thought was a sure hit, don't get discouraged. There can be a lot of different reasons why it was returned. Instead of getting discouraged, grab your list, find another market, and send the poem out again.