1)
Why did Yehoshua demand that they accept to be witnesses?
1.
Rashi: He saw prophetically that in the days of Yechezkel, they will say "we will be like the nations" (Yechezkel 20:32). He made them accept now, so Yechezkel could reply "you already accepted in the days of Yehoshua"! Their acceptance in the days of Moshe was not enough, lest they say that it was in order to enter the land. Now, they already entered and received the land!
2)
About what must they be witnesses?
1.
Radak: That they chose to serve Hashem. Some say that the body and soul in you [are the witnesses].
2.
Malbim: You chose to serve Hashem amidst intellect, and not for the sake of reward, which is really serving yourselves.