array = ConstantArray[1, {5, 5}];
Fold[ArrayPad, array, {-1, 1}] // MatrixForm // TeXForm
$\left( \begin{array}{ccccc} 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 1 & 1 & 0 \\ 0 & 1 & 1 & 1 & 0 \\ 0 & 1 & 1 & 1 & 0 \\ 0 & 0 & 0 & 0 & 0 \\ \end{array} \right)$
Also
ArrayPad[ArrayPad[array, -1], 1] // MatrixForm // TeXForm (* or *)
MapAt[0 &, array, {{All, {1, -1}}, {{1, -1}, All}}] // MatrixForm // TeXForm (* or *)
ReplacePart[array, {1 | Dimensions[array][[1]], _} | {_, 1 | Dimensions[array][[2]]} :> 0]
// MatrixForm // TeXForm
$\left( \begin{array}{ccccc} 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 1 & 1 & 0 \\ 0 & 1 & 1 & 1 & 0 \\ 0 & 1 & 1 & 1 & 0 \\ 0 & 0 & 0 & 0 & 0 \\ \end{array} \right)$