Here is what Bonhoeffer said, "The only man who has the right to say that he is justified by grace alone is the man who has left all to follow Christ"- Dietrich Bonhoeffer
This is similar to Jesus' words...
Luke 14:26-27 ESV
"If anyone comes to me and does not hate his own father and mother and wife and children and brothers and sisters, yes, and even his own life, he cannot be my disciple. [27] Whoever does not bear his own cross and come after me cannot be my disciple.
Bonhoeffer uses the term grace alone, and then adds works of 'leaving all to follow Christ'. Jesus was referring to discipleship not justification. In a sense, Bonhoeffer was taking a Roman Catholic view of justification where we are justified after all is said and done.
Imputed righteousness and justification go hand in hand. Imputed righteousness is the means by which a believer is justified by faith; it is the belief that God "counts" or "reckons" Christ's perfect righteousness and obedience to a believer as if it were their own, through their faith in Him.
Again:
Romans 5:19 ESV
For as by the one man's disobedience the many were made sinners, so by the one man's obedience the many will be made righteous.
Bonhoeffer, obviously, is speaking of discipleship, not justification (even though he mentions 'justified by grace alone').He is mixing Law and Gospel, something C.F.W. Walther (also a Lutheran) said was a 'no-no'.