You cannot cancel an iMessage. But if you sent an iMessage unintentionally, it will be possible for you to delete it. Make sure that you delete it as soon as possible, so that the recipient will not notice it.