Vayikra / Leviticus 25:39 · Pshat
וְכִי־יָמוּךְ אָחִיךָ עִמָּךְ וְנִמְכַּר־לָךְ לֹא־תַעֲבֹד בּוֹ עֲבֹדַת עָבֶד׃
And if your brother becomes poor beside you and sells himself to you, you shall not make him work the work of a slave.
Pshat פְּשָׁט
Not the work of a slave
A person fell into trouble and came to work for you. May you give him what degrades him, since he depends on you?
Rashi: "the work of a slave" is degrading work that marks him as a slave: not carrying his master's things to the bathhouse and not putting on his shoes. Haamek Davar: these bans speak of one taken into the house for household service, for only there are there honoured and degrading tasks. And only one who is known is taken into the house, so it says "beside you."
How Rashi and Haamek Davar explain it
Rashi The work of a slave
Degrading work, by which he is recognised as a slave: that he should not carry his things after him to the bathhouse and not put on his shoes.
Haamek Davar And if your brother becomes poor beside you
As written, that he is used to you. Scripture put this first, because the warnings "you shall not make him work the work of a slave" and "you shall not rule over him with harshness" (Vayikra / Leviticus 25:43) apply only to one who buys a slave for service in his house. And there are many kinds of service there, honoured and degrading. Not so one who buys a slave to work his field: all the tasks are known and necessary, and nothing can be added or taken away beyond the need.
And a poor man who sells himself to a rich man, the rich buyer takes into his house only if he is used to him and knows he is not a thief. Therefore "beside you" is written. For otherwise the sages said in the tractate Derech Eretz: "suspect him." And therefore these warnings are not written in the section Mishpatim, which speaks of one who buys a Hebrew slave from the court. There it is about one sold for theft, and he is most likely sent to the field.
Takeaway
A Hebrew slave serves six years or until the yovel. He must be fed and kept like the master himself, "for it is good for him with you" (Devarim / Deuteronomy 15:16, Kiddushin 20a).
A thief who had nothing to pay for what he stole was sold by the court as a slave for six years (Shemot / Exodus 22:2).