xL = get(gca, 'XLim');
plot(xL, [0 0], '--')
Remember, the ground is a height and height is Y rather than X.
The bit about getting the XLim is finding the left and right margins of what you currently have plotted; then the plot command plots a line across from the left to right margin.
