It's a historical accident—they’re really two different words.
In the sense buttocks, the word goes back to OE ærs, and beyond that to Proto Indo-European: there are cognates in Greek, Hittite and Old Irish. This is reflected in the ordinary British English arse—the {r} is dropped only in US English.
In the sense donkey, the word goes back to OE assa, derived (it is thought) via Celtic from Latin asinus (which may itself be of Middle Eastern origin).
See the Online Etymological Dictionary, s.v. arse and ass, and the Oxford English Dictionary, s.v. arse and ass.