Nowadays, ontologies are backbone of Semantic Web. Several domains use ontologies as knowledge models. As their number is constantly increasing, designers are opting to reuse some of those that exist to build new ones. When it is impossible to reuse a part depending on its organization, they import the whole ontology and this makes the manipulation cumbersome especially if the ontology has large concepts. Therefore, segmenting ontologies into partitions, if they are not yet, becomes a constant challenge for designers. This paper presents an approach to modularize ontology using hidden Markov model. Ontology triples are extracted within ontology through SPARQL queries and labelled with integers. The labelled triples constituted a Markov chain where ontology concepts are states and ontology relationships are symbols. This set is used to initialize HMM parameters such as states transition probabilities and symbols observation probabilities matrix and initial states probabilities vector. The transition probabilities matrix of HMM is then used as input of K-Means algorithm to generated modules of ontology concepts. This approach does not handled ontology axioms, which characterize heavy ontologies, and only lightweight ontologies are considered. Experiment on eighteen ontologies, obtained modules satisfied ontology modularization criteria such as independence, non-redundancy, correctness and completeness.