The term translated as a gracious thing
is simply the Greek word for “grace,” that is, an undeserved gift, or better, a gift given contrary to what one deserves. So in the Bible it denotes time and again the kindness of God as expressed to sinners in Jesus Christ; it is also how Peter used the term in 1 Peter 1:2, 1 Peter 1:10.
In the present verse, Peter tells his readers that their ability to submit to masters (good or bad) is actually a gift from God; more, the ability to carry the injustice that may come to them from crooked masters is a gift from God. As an example, the Lord strengthened Joseph to accept his enslavement (as opposed to being eaten up by bitterness; see Genesis 39:2). Once Joseph was unjustly imprisoned due to his resisting Potiphar’s wife’s advances, the Lord graced Joseph with additional strength so that he became a blessing in prison (Genesis 39:21–23; see also Luke 6:35). Submission to overbearing masters is possible because the God of all grace will provide every gift needed in every eventual crisis—in his divine and inexplicable way.
19 For this is a gracious thing, when, mindful of God, one endures sorrows while suffering unjustly.