How can I limit scaling on one axis?
The reason for this is because you have two edges selected, meaning your total selection has some height. Scaling by default will scale along each axis by the same percentage, thus it flattens some. To not scale on the Z axis, simply scale only on the X and Y axes. To do so, press S then Shift+Z to disable scaling on the z axis.