Braces for block matrix

Personally I would not add these braces since they contain redundant information. If you know that the single blocks have fixed dimensions, as indicated by the notation $0_{n\times m}$ then all you need to know in addition to specify the dimension of the matrix is how many blocks there are. This can be done e.g. with TikZ as follows:

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}

\begin{equation}
  S=\vcenter{\hbox{% really dotted from https://tex.stackexchange.com/a/52856/121799
  \begin{tikzpicture}[really dotted/.style={dash pattern=on 0.01pt off 4.5pt,
                                         line cap=round},inner xsep=0pt]
  \matrix[matrix of math nodes,left delimiter={[}
  ,right delimiter={]},column 2/.append style={column sep=3em},
  column 5/.append style={column sep=3em}] (mat)
   {
    M_n & & M_1 & 0_{n\times m} &        & 0_{n\times m}\\
        a_nI_m &  & a_1I_m & a_0I_m &  & 0\\
        ~ &  & & &  &  \\[1ex]
        0 & & a_nI_m & 0 &  & a_0I_m\\
    };
    \draw[really dotted,line width=1pt,shorten >=2pt] (mat-1-1) -- (mat-1-3)
    node[midway,above,font=\tiny]{$m$ times}
     (mat-1-4) -- (mat-1-6) node[midway,above,font=\tiny]{$m$ times}
     (mat-2-1) -- (mat-2-3) (mat-2-4) -- (mat-2-6)
     (mat-4-1) -- (mat-4-3) (mat-4-4) -- (mat-4-6);
    \draw[really dotted,line width=1pt,shorten >=2pt] 
    (mat-2-1) -- (mat-4-3) (mat-2-1) -- (mat-4-1)
    (mat-2-3) -- (mat-4-3) (mat-2-4) -- (mat-4-6) (mat-2-4) -- (mat-4-4)
    (mat-2-6) -- (mat-4-6);
    \end{tikzpicture}}}
     \end{equation}
\end{document}

enter image description here


Another alternative option could be using the nicematrix package. You always get the same image as the very good user @marmot but here there is a short code; the dots are slightly spaced from the elements of the matrix. With a zoom between the two images you can see the difference between two images.

enter image description here

\documentclass{article}
\usepackage{nicematrix}
\begin{document}
\[S=\left[\begin{NiceArray}{CCCCCC}
M_n & \overset{\scriptstyle m \text{ times}}{\Cdots} & M_1&\!\!\!  0_{n\times m}&\overset{\scriptstyle m \text{ times}}{\Cdots} &0_{n\times m}\\
a_nI_m & \Cdots & a_1I_m&\!\!\!  a_0I_m&\Cdots &  0\\
\Vdots & \Ddots &  \Vdots &\!\!\!     \Vdots        &    \Ddots     & \Vdots\\
0 & \Cdots & a_nI_m        & 0&\Cdots &a_0I_m\\
\end{NiceArray}\right]
\]
\end{document}

as supplement to @Sebastiano's answer (+1) ... with use of the bNiceMatrix instead of NiceArray and adding $m$ times in tikzpicture:

\documentclass[margin=3mm, preview]{standalone}
\usepackage{nicematrix}
\usetikzlibrary{quotes} % for labels "m times"

\begin{document}
\[
S = \begin{bNiceMatrix}[columns-width=2em, name=m]
M_n     & \Cdots & M_1     & 0_{n\times m} & \Cdots & 0_{n\times m} \\
a_nI_m  & \Cdots & a_1I_m  & a_0I_m        & \Cdots & a_1I_m        \\
\Vdots  & \Ddots & \Vdots  & \Vdots        & \Ddots & \Vdots        \\
0       & \Cdots & a_nI_m  & 0             & \Cdots & a_0I_m        \\
\end{bNiceMatrix}
\]
\tikz[remember picture,overlay,font=\tiny]
\path   (m-1-1) to ["$m$ times"] (m-1-3)
        (m-1-4) to ["$m$ times"] (m-1-6);
\end{document}

enter image description here

note: for final result you need to compile above mwe at least twice.