In this verse there is a stop in the main story. Here John gives background information about Jesus fulfilling Scripture. (See: [[rc://en/ta/man/jit/writing-background]])
Here "the word" refers to the words Jesus had prayed. You can translate this in an active form. Alternate translation: "This happened in order to fulfill the words that he had said when he was praying to his Father" (See: [[rc://en/ta/man/jit/figs-explicit]] and [[rc://en/ta/man/jit/figs-activepassive]])