Looking at your provided arrays, I'm assuming you want to use the key rank as the joining point (which doesn't seems such a good idea, and question will be if their unique or not) if they are unique then a tiny method can help to fetch element based on their rank and the rest is just assembling the result :
<?php
$arr1 = [
    [
        'rank' => 579,
        'id' => 1
    ],
    [
        'rank' => 251,
        'id' => 2
    ],
];
$arr2 = [
    [
        'size' => 'S',
        'rank' => 251
    ],
    [
        'size' => 'L',
        'rank' => 579
    ],
];
function getItemByRank($array, $rank)
{
    foreach ($array as $item){
        if ($item['rank'] === $rank) {
            return $item;
        }
    }
}
$result = [];
foreach ($arr1 as $k => $item) {
    $match = getItemByRank($arr2, $item['rank']);
    if (isset($match)) {
        $result[$k] = $item;
        $result[$k]['size'] = $match['size'];
    }
}
print_r($result);
output:
Array
(
    [0] => Array
        (
            [rank] => 579
            [id] => 1
            [size] => L
        )
    [1] => Array
        (
            [rank] => 251
            [id] => 2
            [size] => S
        )
)