To prevent the grain from being stolen. Lange's Commentary speculates that Boaz was perhaps relieving his overseer that night, since Naomi informs Ruth that “tonight he winnows barley” in verse 2.
Ver. 7. And Boaz ate and drank, and was cheerful. It illustrates the simplicity of ancient patriarchal times and manners, that Boaz, the wealthy proprietor of a great estate, himself keeps watch on his threshing-floor, works till late, and then betakes himself to rest in the solitude of the open field.1 It is clear that he did not do this every day; for the well-informed Naomi says, “to-night he winnows barley.” It is probable that this night he relieved his overseer.
1 [The same practice is still continued in Palestine, cf. Rob. ii. 83; Thomson, ii. 511 Its design is, of course, to keep the grain from being stolen. Thomson says, that “it is not unusual for husband, wife, and all the family to encamp at the threshing floors, and remain until the harvest is over.”]
-A Commentary on the Holy Scriptures: Critical, Doctrinal, and Homiletical, with Special Reference to Ministers and Students, Volume 4. John [Johann] Peter Lange, translated by Philip Schaff. New York, 1872.
Here is a picture of a reconstructed threshing floor at Yad Hashmonah, Israel:
There would be threshed and winnowed grain in large quantities at the threshing floor, and the grain would need to be guarded against theft. See also this video reenactment of Boaz going to the threshing floor. At the 7:51 mark, Myles Weiss talks about the threshing floor and also mentions that men would sleep there and guard the grain that had come in.