Not any time they wished. In the OT in the Mosaic Law found in Leviticus and Deuteronomy it is clearly spelled out how to treat slaves. And randomly beating them is not there.
Ephesians 6:9
Chapter Parallel Compare
9 And masters, treat your slaves in the same way. Do not threaten them, since you know that he who is both their Master and yours is in heaven, and there is no favoritism with him.
Exodus 21:26-27
Chapter Parallel Compare
26 “An owner who hits a male or female slave in the eye and destroys it must let the slave go free to compensate for the eye. 27 And an owner who knocks out the tooth of a male or female slave must let the slave go free to compensate for the tooth.
Deuteronomy 23:15-16
Chapter Parallel Compare
15 If a slave has taken refuge with you, do not hand them over to their master. 16 Let them live among you wherever they like and in whatever town they choose. Do not oppress them.
Leviticus 25:42-46
King James Version
42 For they are my servants, which I brought forth out of the land of Egypt: they shall not be sold as bondmen.
43 Thou shalt not rule over him with rigour; but shalt fear thy God.
44 Both thy bondmen, and thy bondmaids, which thou shalt have, shall be of the heathen that are round about you; of them shall ye buy bondmen and bondmaids.
45 Moreover of the children of the strangers that do sojourn among you, of them shall ye buy, and of their families that are with you, which they begat in your land: and they shall be your possession.
46 And ye shall take them as an inheritance for your children after you, to inherit them for a possession; they shall be your bondmen for ever: but over your brethren the children of Israel, ye shall not rule one over another with rigour.