Joshua is asking them to make a commitment. Notice how he does this. He reminds them of what has already happened to them, what benefits they have experienced already. And he outlines for them what their future can be like--if.
When the Bible was collected into the form that has been handed down to us, the descendants of Joshua's audience would have known the defeat by Babylon, the agonies and disruptions of exile. They could look back on their own inability to be loyal to the commitment to God that Joshua had demanded of them.
But, of course, this passage is about more than history, even layers of history. It is about us. We still gather in communities. We are still being asked to choose who is the boss of us. And we still say that we serve the Lord, and we still --finish this sentence for yourselves.