Okay, so I just did this successfully (on Arch / EndeavourOS). So I'm putting it down here, in case anyone wants to know how.
On Linux your Firefox profiles are typically stored at:
~/.mozilla/firefox
There might be multiple profiles in there. Profiles are directories, with random names, but usually followed with something like .default-release or .default. You can find out which your profile is by running Firefox with -P (so just firefox -P on the terminal). That's the profile you want to save (you could move all the profiles over as well).
(Optional Step: even though it's not actually necessary, I would back up your profile data. If you have a folder ~/backups, I'd run rsync -a ~/.mozilla/firefox ~/backups/ to copy it over.)
First, I'd install the native non-Flatpak system Firefox. On Arch, this is done with sudo pacman -R firefox, and on Ubuntu, it's probably sudo apt remove firefox.
Second, install Firefox from Flathub. Run flatpak install org.mozilla.Firefox. Don't launch the newly installed Firefox yet.
Note: the Flathub Firefox's firefox folder lives here:
~/.var/app/org.mozilla.firefox/.mozilla/firefox/
Now, move your old profile(s) into this folder. What I did was:
Move my specific profile folder. So: mv ~/.mozilla/firefox/abcd123e.default-release ~/.var/app/org.mozilla.firefox/.mozilla/firefox/ (where abcd123e.default-release is your profile folder now)
Copy profiles.ini file over similarly (if one doesn't already exist for the Flathub Firefox -- it shouldn't, if you didn't open it). After copying it, delete the [InstallXXX....] section.
(You could just overwrite the whole firefox folder I suppose, but I haven't tried that.)
That's it. I launched the Flathub Firefox, and everything was working perfectly fine, and as expected.