If you set $term->tid
for a taxonomy term you save with taxonomy_term_save(), the function will take you are updating an existing taxonomy term, with the consequence that the taxonomy term is not saved.
You could change the taxonomy term ID for the taxonomy term you right saved, but there is the risk of conflict with an existing taxonomy term you didn't import. You should change more that one database table, and you should let other modules handling data related to taxonomy terms know they need to update their data, which means you probably should make those modules think a taxonomy term is deleted, and a new taxonomy term is created.
See also the code for taxonomy_term_delete() to understand what Drupal does when a taxonomy term is deleted.
If you really need to export taxonomy terms from a site, and import them in a different Drupal site, you should be interested to the Universally Unique Identifier module. In that way, the taxonomy term exported from site A, and imported in site B will have the same UUID.
In Drupal 8, any entity defined from Drupal has a UUID. The schema definition used for taxonomy terms in Drupal 8, for example, is the following one.
$schema['taxonomy_term_data'] = array(
'description' => 'Stores term information.',
'fields' => array(
'tid' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'Primary Key: Unique term ID.',
),
'uuid' => array(
'description' => 'Unique Key: Universally unique identifier for this entity.',
'type' => 'varchar',
'length' => 128,
'not null' => FALSE,
),
'vid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The {taxonomy_vocabulary}.vid of the vocabulary to which the term is assigned.',
),
// …
),
// …
);