Try something like this
$posts = get_posts( array(
'numberposts' => -1,
'meta_key' => 'prime',
'meta_value' => 'yes'
) );
$post_ids = array();
if ( $posts ) {
foreach ( $posts as $post ) {
// Push post's IDs into array
array_push( $post_ids, $post->ID );
}
}
code isn’t tested but it should work. If you don’t wont post ids into array just replace whole array_push
line with $post->ID
UPDATE
Set ‘numberposts’ argument to -1, so it will return all posts not only 5 as default. Thanks to @Brady