Technically, your friend cannot replace you on a trek.
If you want your friend to join the batch instead of you, here is what you have to do.
Log in to your dashboard (You can access your dashboard after you have booked your trek) and cancel your slot.
The slot will get opened up on the website.
Ask you friend to register for the trek almost at the same time.
This is because there could be a lot of people registering for the same date at the same time.
Note. The cancellation charges do apply if you cancel the trek.