With bash.
# disable job control and enable lastpipe to run mapfile in current environment
set +m; shopt -s lastpipe
# feed array_files with the output of your ssh/find command
ssh ... | mapfile -t array_files
# returncode of first command in pipe (here ssh)
echo "${PIPESTATUS[0]}"
# content of array array_files
declare -p array_files
In a script job control is disabled by default.