When deserializing content from another content repository, each imported node will come with its attached jcr:primaryType and jcr:mixinTypes properties. This information may be used while deserializing to validate the node according to the specified node types (and to do whatever internal bookkeeping the implementation requires in terms of noting the node types of the incoming nodes).
Any node types referenced by the imported content that are not skipped (see 7.3.3 Respecting Property Semantics) will have to be already registered with the target repository. This implies that it will be necessary to first import and register those node types referenced by the content that are not already registered with the target repository.
Though this specification does not attempt to define the details of the process of importing node type definitions, the fact that node type definitions may themselves be stored as normal content (see 126.96.36.199 nt:nodeType) means that the standard serialization/deserialization mechanism can be used to export and import their definitions (see 6.5 Exporting Repository Content and 7.3 Importing Repository Content). Actually registering them is, as mentioned, outside the scope of this specification (see 6.7.1 Node Type Configuration).