In this paper, first we introduce the Heun equation. In order to solve such equation we show the generators of generalized \(sl(2)\). Second, we arrange the Heun equation in terms of new operators formed of generalized \(sl(2)\) generators and it's commutator relation. Here, instead of \(J^+(r), J^-(r)\) and \(J^0\) we use the \(P^+(r), P^-(r)\) and \(P^0(r)\) as operators of generalized sl(2) algebra. This correspondence gives us opportunity to arrange the parameters \(\alpha\) and \(\beta\) in \(P^0(r)\). Also, the commutator of such operators leads us to have generalized \(sl(2)\) algebra. Also, we obtain the Casimir operators and show that it corresponds to \(P^+, P^-\) and some constants. These operators lead to deform the structure of generalized \(sl(2)\) algebra in the Heun equation. Finally, we investigate the condition for exactly and quasi-exactly solvable system with constraint on the corresponding operators \(P^+\) and \(P^-\).