in my master thesis project I want to merge several ontologies (filled only with individuals) having different namespaces, but sharing the same imports and some individuals(
The namespace for the ontologies is not the issue - the problem is when the ontologies have the same ontology id. In that case, they cannot be merged in the same manager - the manager needs the relation ontologyID->ontology
to be functional. To be able to use the same ontology id for a new ontology, it must be managed by a separate manager.
Note that the ontology IRI does not dictate the namespace for the individual names contained in it; once parsed, the individual IRIs are independent of the ontology, and the axioms can be moved to other ontologies without issues.
Can you describe what you mean by ontology headers?
The ontology axioms themselves can be merged in multiple ways; the simplest I can think of is adding all axioms from both ontologies to a set, and using the set to create a new ontology.