From the look of the uniforms the photograph fits the time period for the Zulu War.
As for what is going on, I would say that the sailor with his back to the camera is dancing for the entertainment of his crew mates while band members accompany him. Sailors and marines had to provide for their own entertainment in the 19th century. (No movies or television in those days.) Ship's crews often put on small theatrical performances.
Participation in athletic competition were also common, at least while on shore. HMS Active's sailors and marines competed with one another on Boxing Day 1878.
Petty Officer Tom