Let $M$ be an toplogical abelian group. I heard we can define $\hat{M}$ by completion of $M$ with respect to the topology defined by the subgroups of finite index.
For example, if $M=\Bbb{Z}$, then subgroups of finite index is exactly $n\Bbb{Z}$ and $\hat{M}=\varprojlim \Bbb{Z}/n\Bbb{Z}=\hat{\Bbb{Z}}$. In this example, inverse system is given by $\{\Bbb{Z}/n\Bbb{Z}\to \Bbb{Z}/m\Bbb{Z} (m\mid n)\}$
But it is difficult for me to understand we can define $\hat{M}$ for every topological abelian group $M$. What is inverse system of the inverse limit for general $M$?
For example, if $M=E(K)$($E/K$ is an elliptic curve over number field $K$.), I cannot understand what are subgroups of finite index, thus I cannot grasp its completion.
I think you are mixing up two completions. What you're talking about is called the profinite completion, and it is defined for an arbitrary group $G$, not necessarily abelian, as the cofiltered limit of all finite quotients $G/N$. The inverse system has a unique homomorphism $G/N \to G/M$ whenever $N \subseteq M$ where $N, M$ are two finite index normal subgroups. This construction does not make any reference to a topology on $G$, and in fact induces a topology on $G$, namely the profinite topology.
It sounds to me like you're confusing it with the Cauchy completion of a topological abelian group which is something else (and uses a given topology). For example the profinite completion of $\mathbb{Z}$ is the profinite integers $\widehat{\mathbb{Z}}$ but its Cauchy completion is just $\mathbb{Z}$.
As for the case of elliptic curves, by the Mordell-Weil theorem $E(K)$ is finitely generated, so it has the form $T \times \mathbb{Z}^r$ where $T$ is a finite abelian group and $r$ is the rank. We have that
So altogether we get that $\widehat{E(K)} \cong T \times \widehat{\mathbb{Z}}^r$.