Zero padding IS not required, per se. However, with a $3\times 3$ square kernel, pixels exactly on the borders of the image lack outer neighbors, if one wants to estimate their discrete derivative/smoothing. This is somehow illustrated below
- use a shorter derivative estimator on image borders (which does not make assumptions regarding side effects), like Roberts cross edge detectors,
- extend the image properly; zero-padding (for centering, one more row or column on the right and left, and bottom or bottom, suffices) is the simplest version. Yet, symmetric/anti-symmetric, periodic or mirror extensions can be more appropriate: half-pixel or whole pixel antisymmetric extensions respect better the continuity and smothness of border features.
- use non-linear operators/filters, that could be more robust (median, stack, rank, mathematical morphology)
- discard border values, which you cannot compute in any sound manner without assumptions.
The Sobel Filter is a $ 3 \times 3 $ matrix (it is separable, but let's ignore that).
The anchor pixel is the middle one hence to evaluate the operator on pixels on the upper row the operator needs data above them.
Same goes for pixels on the last row, left-most column or right-most column.
This is usually solved by padding the image (I actually use "Replication" instead of Zero Padding).
Another option is to set the output to be smaller image by not evaluating the extreme rows or columns.