As taken from here :
Firefox, by default, interprets horizontal scrolling as the forward/back buttons.
This is very annoying with two-finger scroll, as it will jump pages without warning.
After trial and error I figured out how to disable this. In Firefox go to
about:config (type it in address field)
change mousewheel.horizscroll.withnokey.action to 0
change mousewheel.horizscroll.withnokey.numlines to 1