Plugin the answers into the sentence to see if it makes sense.
They had been known each other for a long time before they finally decided to get married, it doesn't sound right so you can eliminate that answer and choose the other one.
They had known each other for a long time before they finally decided to get married sounds grammatically correct.