Your call should include the ID:
get_post_meta($p->ID,"_location",true);
And what is $locations
?
If an array, it should be $locations[] =
If a string, it should be $locations .=
If you only want unique locations, you could do this:
$locations = array();
foreach($posts as $p){
$location = get_post_meta($p->ID,"_location",true);
if( ! in_array( $location, $locations) )
$locations[] = $location;
}