Let $G$ be the disjoint union of the cosets $Ha_1,...,Ha_n$, and furthermore, let $H$ be the disjoint union of the cosets $Kb_1,...,Kb_m$. For brevity, let $K_{i,j} := Kb_ia_j$ and
$\Phi = \{K_{i,j}: 1 \leqslant i \leqslant m,\,\, 1 \leqslant j \leqslant n\}$
First show that the collection $\Phi$ covers $G$. Supposing $x \in G$, there is some $j$ such that $x \in Ha_j$. In particular, $x = ha_j$ for some $h \in H$. Moreover, because $h \in H$ we also know there is some $i$ such that $h \in Kb_i$, which is to say $h = kb_i$ for some $k \in K$. But then $x = ha_j = kb_ia_j \in K(b_ia_j) = K_{i,j}$. This proves that $\Phi$ covers $G$.
Next, we will show $| \Phi | = mn$. To that end suppose $K_{p,q}=K_{r,s}$. We will show that $p=r$ and $q=s$. Now, because $Kb_p,Kb_r \subset H$, we know that $K_{p,q} \subset Ha_q$ and $K_{r,s} \subset Ha_s$. But by construction $Ha_q,Ha_s$ are disjoint when $q \neq s$. So it must be that $q = s$ and $a_q = a_s := a$. Consequently, we have
$Kb_p = (Kb_p)(a_qa^{-1}) = (K_{p,q})a^{-1} = (K_{r,s})a^{-1} = (Kb_r)(a_sa^{-1}) = Kb_r$.
So again by construction, it must be that $p = r$. This concludes the proof that $| \Phi | = mn$
Finish up with
$[G:K] = |\Phi| = mn = [H:K][G:H] = [G:H][H:K]$.
Also, you have not mentioned anything regarding normality of $H,K$. If you knew $H,K$ were normal subgroups of $G$, then as a @FofX noted, the third isomorphism theorem is applicable:
$(G/K) / (H/K) \cong G/H$.
Thus
$[G:K] $
$=|G/K| $
$= [G/K:H/K] \cdot |H/K| $
$= |(G/K)/(H/K)| \cdot |H/K| $
$= | G/H| \cdot |H/K| $
$= [G:H] \cdot [H:K]$
Where the fourth inequality follows from $|(G/K)/(H/K)| = |G/H|$ (which in turn is a direct result of the third isomorphism theorem.)