HMMs (Hidden Markov Models) are widely used for biological signal, such as EEG (electroencephalogram) sequence, analysis because of their ability to incorporate sequential information in their structure. A recent trends of research are going after the biological interpretable HMMs, and we need to control the complexity of the HMM so that it has good generalization performance. So, an automatic means of optimizing the structure of HMMs would be highly desirable. In this paper, we described a procedure of classification of motor imagery EEG signals using HMM. The motor imagery related EEG signals recorded from subjects performing left, right hand and foots motor imagery. And the proposed a method that was focus on the validation of the HSA (Harmony Search Algorithm) based optimization for HMM. Harmony search algorithm is sufficiently adaptable to allow incorporation of other techniques. A HMM training strategy using HSA is proposed, and it is tested on finding optimized structure for the pattern recognition of EEG sequence. The proposed HSA-HMM can performs global searching without initial parameter setting, local optima, and solution divergence.