A boundary to a park or garden that doesn’t interrupt the view.
You can still often see ha-has in the gardens of British stately homes. They usually consist of a sunken wall with its top at garden ground level, bounded with a ditch on the outer side. This stops cattle or sheep getting into the gardens without interrupting the view from the house. An older — more usefully descriptive — name was sunken fence. The class-related implication of this boundary is obvious from Anthony Trollope’s Barchester Towers: “Two marquees had been erected for these two banquets: that for the quality on the esoteric or garden side of a certain deep ha-ha; and that for the non-quality on the exoteric or paddock side of the same”. So far as we can tell, the word was originally French. When it crossed the Channel into Britain, it was variously spelled at first, often as ah ah, and it seems certain that the idea of a surprise was intimately associated with it. If you stumbled across it in the dark you certainly wouldn’t think it at all funny. (worldwidewords.com)