It introduces a dependent clause that explains how or by what means something happens.
For example:
* "He devised a plan whereby the prisoners could escape."
* "She found a way whereby she could earn extra money."
In these examples, "whereby" connects the main clause (He devised a plan, She found a way) to the dependent clause that explains how the plan or the way was achieved.