I assume the relationship property only exists on the Player node. So, if the _on_Area2D_body_entered() method is triggered by something other than the Player, the code will fail when trying to access the relationship property of that (non-Player) node.
So, it’s checking that the body in question really IS the Player first. If not, it simply returns.
That could be rewritten to make the intent a bit clearer. Something like this:
func _on_Area2D_body_entered(body):
if body.is_in_group("Player") and body.relationship == 0:
target = body
That should be functionally the same as the original code, but (potentially) easier to understand.