I f you didn't know a ha-ha was there it would take you by surprise, leading you to exclaim "Ha-Ha!". It could easily have been called a "Whoa-oa!" i suppose, or an "AAAARRGGHH!!!"
Just looked in my Concise OED and after the description of a ha-ha it says "French, perhaps from the cry of surprise on encountering it". Now whether that means they originated in France or our word for a laugh (ha ha) stems from French, I don't know.