Assuming you're in the root folder where are all directories for compression (in your case /), you can use find along with xargs command, e.g.
find dir1/ -name "*.fit" -print0 | xargs -i% -r0 sh -c 'mkdir -vp "$(dirname "/another_dir/%")" && gzip -vc "%" | tee "/another_dir/%".gz > /dev/null && rm -v "%"'
Note: You can also replace | tee "/another_dir/%".gz > /dev/null with > "/another_dir/%".gz.
This will find all .fit files in dir1/ and pass them to xargs command for parsing where % is replaced with each of your file.
The xargs command will:
- create the empty folder (
mkdir) with its parents (-p) as a placeholder, - compress given file (
%) into standard output (-c) and redirect compressed output totee, teewill save the compressed input into.gzfile (sinceteeby default prints the input to the terminal screen, sending it to/dev/nullwill suppress it, but it'll still save the content into the given file).
After successful compression, remove the original (rm). You can always remove that part, in order to remove them manually after verifying your compressed files.
It is important that you're in relative folder to your dir1/, so all paths returned by find are relative to the current folder, so you don't have to convert absolute paths into relativeconvert absolute paths into relative (this still can be done by realpath, e.g. realpath --relative-to=$absolute $current, but it will just overcomplicate the above command).
On macOS, to use -r argument for xargs, you need to install GNU xargs (brew install xargs) and use gxargs command instead. Similar on other BSD systems.
Related question: gzip several files in different directories and copy to new directory.