How I understand it,
"for the purpose of..." / "In order to....", is the conjunctive form of
～べき, which indicates something that should be done.
たくさん本を読む べき (you should read many books)
エンジニアになる べく 一生懸命勉強した (I studied hard in order to become an engineer)
In the following example sentence, is the
べくして related grammatically or semantically to
起こる べくして 起こった事故だった。 It was an accident waiting to happen.