Two-dimensional materials are extraordinarily sensitive to external stimuli, making them ideal for studying fundamental properties and for engineering devices with new functionalities. One such stimulus, strain, affects the magnetic properties of the layered magnetic semiconductor CrSBr to such a degree that it can induce a reversible antiferromagnetic-to-ferromagnetic phase transition. Using scanning SQUID-on-lever microscopy, we directly image the effects of spatially inhomogeneous strain on the magnetization of layered CrSBr, as it is polarized by a field applied along its easy axis. The evolution of this magnetization and the formation of domains is reproduced by a micromagnetic model, which incorporates the spatially varying strain and the corresponding changes in the local interlayer exchange stiffness. The observed sensitivity to small strain gradients along with similar images of a nominally unstrained CrSBr sample suggest that unintentional strain inhomogeneity influences the magnetic behavior of exfoliated samples.