Oil baths, also known as lubrication baths, were a means of removing such things as dust, dirt, and various other forms of matter that collected in a droid's joints and sockets. Without treatment, the debris could cause the joints to become difficult to move or lock up altogether, a condition known as dust contamination.
The Great Heep was known to provide such a cleansing, along with other pleasantries, to unassuming droids before consuming them.
Luke Skywalker treated C-3PO to an oil bath on the Lars moisture farm after his uncle Owen Lars purchased the droid from Nebit's Jawa tribe. Due to his memory wipe in 19 BBY, C-3PO was unaware that he had been given an oil bath by a restless Padmé Amidala in the Lars garage when she needed a task to take her mind off Anakin's rescue of his mother. The bathing session had been much-needed, as the protocol droid had extensive amounts of sand and dirt lodged in his coverings.