1 Peter 2:18 reads as follows:
“Slaves, in reverent fear of God submit yourselves to your masters, not only to those who are good and considerate, but also to those who are harsh.”
Here Peter is making a powerful point. What he is saying is that Christians are to remain godly in their conduct even if they find themselves under a master who is abusive (the NASB, my preferred translation, puts “unreasonable” in the place of harsh) towards them. In this way God’s unconditional, unwarranted love & mercy can be demonstrated in their lives to those who do not believe.
Furthermore, the example that Peter includes here is a “worst case scenario.” In other words, if his teaching applies to this situation then it applies to less difficult circumstances as well. In this way he urges Christ followers to demonstrate Jesus’ love through their godly character that manifests within the many circumstances, good or bad, that life throws at us. Thus, in no way is Peter actually condoning the harsh nature of treatment towards a slave from a master in question. That would be highly unlikely; it also wouldn’t even make sense considering the ethic that Jesus embodied for his followers to emulate (Mark 13:31, Mat. 22:39).