A low pass filter between the source of the square wave and the measurement equipment. e.g. if the source has some resistance in series with it (which it will), and there's some capacitance in the cable you will get rounded corners. The more resistance and capacitance, the more-rounded/less-square the signal will appear.
This also partly depends on the application. For example, if you run a clean square wave through an amplifier that has bad high frequency response, the leading corners will be rounded.
This goes for anything else in line with the square wave too, like the probe itself as the previous poster pointed out, or even the scope itself.
Even in case the amplifier has a "good" high frequency response the edges will be rounded- however, perhaps not disturbing for the specific application.
A really "clean" squarewave form is a theoretical fiction and would require a bandwidth that is infinite.