I would argue that the concept of duty is one that is common to both British colonial and Yoruba culture alike. According to Yoruba folklore, Elesin is supposed to commit suicide so that his soul will accompany the king's into the next life. However, in trying to postpone his death, he's effectively failing in that duty. A duty that to the Yoruba is sacred.
It's perfectly understandable that Elesin doesn't want to die, but he's a relatively small part of a much bigger picture. Individualism as it exists in the West has no purchase among the Yoruba. For them, everyone and everything is linked together as part of a giant cosmos which encompasses the dead, the living, and those yet to be born. All must must do their duty and must fulfill their divinely-appointed roles within this interlocking system, even if it means sacrificing one's life.
The British colonial officer, Pilkings, is no less committed than the Yoruba to doing one's duty, except that his duty is shorn of all metaphysical or spiritual trappings. His duty is that of a colonial official: to carry out the orders of one's superiors without question. The most important order for any such official to follow is to maintain good order among the indigenous population. This is what Pilkings thinks he's doing by having Elesin arrested to prevent him from committing ritual suicide.