The onPremisesSecurityIdentifier property is not returned by default, you have to specifically request it, as you have tried above. The problem with your example is that PowerShell treats the "$" character to designate variables, and in this case it's effectively looking for $select variable, which does not exist. In turn, you get the "standard" output, without the requested property. To work around this, you need to escape the $ char or use single quotes instead. Any of these would do:
$res = Invoke-MgGraphRequest -uri "https://graph.microsoft.com/v1.0/devices?`$select=id,onPremisesSecurityIdentifier"
$res = Invoke-MgGraphRequest -uri 'https://graph.microsoft.com/v1.0/devices?$select=id,onPremisesSecurityIdentifier'
$res.value