Using a plugin doesn’t keep the IDs of the categories and exporting/importing of the
wp_term_taxonomy tables only works on categories without parents, it seems. The admin panel still shows there are many pages of categories, but they are all empty.
In general you can’t. ID numbers given at one site might be already used at another.