The only answers I have been able to find want me to download third party software. It is NOT an acceptable solution to expose all of my SMS history to a third party. Maybe there's an open source solution?
With root
If you're rooted or willing to root, you can check out this method: Where on the file system are SMS messages stored?
Note: If you're transferring between different versions of Android, or even ROMs, I would check if the SMS format is the same.
Third party app
- There's SMS Backup+, which is an open source app I found - GitHub, Google Play.
- I'm using SMS Backup & Restore for a long time (maybe years) - from their Privacy Policy, it seems that the only data they send is anonymous usage data to Google Analytics.
Note: You can use a well reviewed and popular third party app from play store (bonus if it's an editors choice), and after installing it (before even opening) - move to flight mode, backup locally, remove the app and transfer to your computer or other phone.