Great question — answering as the UphillTech team:
Yes, and No. Yes, you can run an older FreeBSD "world" inside a jail (I have a 9.1 world running under a 15.1 kernel), but that is not necessarily the same as checking that your software is compatible with that version. You say "compiles" and at first glance, my eye saw "complies." You're compiling the code against the older libraries that were current at the time of 12.0, but your code is running under the 15.1 kernel. Granted, it's a good first approximation (because the FreeBSD project actually does try hard not to break userspace). If you want to be 100% sure your code runs under FreeBSD 12, you should use a bhyve VM. Enjoy!
Full answer by Jim L.: https://unix.stackexchange.com/a/806427 (CC BY-SA 4.0).
Need it done for your business? UphillTech.