While migrating to a new laptop, I was looking for a way to merge my zsh history from my old laptop and my new laptop. It ended up being possible using builtin zsh commands.
# Load file 1
builtin fc -R -I /Users/justyns/.zsh_history
# Load file 2
builtin fc -R -I /Users/justyns/.zsh_history-from-old-laptop
# Load more files ...
# Write to new file
builtin fc -W "$HISTFILE"
From the man page:
'fc -R' reads the history from the given file, 'fc -W' writes the history out to the given file, and 'fc -A' appends the history out to the given file. If no filename is specified, the **** is assumed. If the -I option is added to -R, only those events that are not already contained within the internal history list are added. If the -I option is added to -A or -W, only those events that are new since last incremental append/write to the history file are appended/written. In any case, the created file will have no more than **** entries.