This is from Hymn 238, with words by John Greenleaf Whittier. Here is the full verse:
O, sometimes gleams upon our sight,
Through present wrong, th’ eternal right;
And step by step, since time began,
We see the steady gain of man.
You can read the full hymn by clicking here.
Whittier lived at the same time as Mary Baker Eddy, who greatly admired the poet. At the request of a mutual friend she once visited him when he was in need of healing. Here is an account of that visit on the Mary Baker Eddy Library website.