Your command (with added double quotes):
ssh "$user@$slave_ip" bash "$dest_root/$dest_dir/slave_run"
The capture the exit code will be in `$?` after the execution of that command.
Example:
$ ssh someserver sh -c 'false'
$ echo $?
1
To capture it:
$ ssh someserver somecommand
$ code=$?
Alternatively, get the command on the server to output the exit code and capture it as a string:
$ code=$( ssh server sh -c "somecommand; echo \$?" )
In your case:
$ code=$( ssh "$user@$slave_ip" sh -c "$dest_root/$dest_dir/slave_run; echo \$?" )
It's necessary to escape the `$` of `$?` as the command is within double quotes and we'd like `$?` to be evaluated by the shell on the server side, not by the shell on the client.