# ArrayPad[ConstantArray[0, Dimensions@# - 2], 1, 1] &@
Array[Times, {5, 8}]
or
# SparseArray[# -> 1 & /@
Flatten[{#, Reverse@# } &@
{_, #} & /@ {1, -1}, 1],
Dimensions@#] &@ Array[Times, {5, 8}]