This is very common in many Arabic/Muslim countries.
It's known as a "Sharddaf",
or in plain English: a bum-washer ;-)
It's a more flexible version of a bidee and is used to wash after relieving yourself.
Muslims generally prefer to wash rather than using toilet paper, and I believe it also has something to do with the requirement of performing "Wudoo" (ritual washing/abulution) before prayer time.
Unfortunately, many people use this small device far too liberally, with little or no sense of aim or direction resulting in partial flooding of many toilet stalls. It's quite disgusting to say the least, having to roll-up your trousers before entering the cubicle... so be aware and don't fall.
Oh, and another piece of advice: if you decide to use the sharddaf, make sure you are holding the nozzle the right way around... I've seen many unknowing tourists coming out of the toilets with very wet clothes!
--> NOTE: In the past, most Arabs and also Asians were used to squatting over a "traditional" toilet. You can still find these toilets in some of the older shopping malls and even in Dubai airport (!). They are nothing more than a tiled hole in the ground, with the aforementioned sharddaf for washing. But don't panic: there are never more than 1 or 2 cubicles with these "holes" and all other cubicles consist of the comfortable, modern, shiny and white porcelain thrones ;-)

