If Joshua’s attack took place at dawn, it would have been when the sun was just about to rise in the east (where the city of Gibeon was) and while the moon was still visible in the west (the Valley of Aijalon). Joshua's request for the sun and moon to stand still would then be a request for the Israelites to be able to continue their attack under the relative cover of darkness.1 There would have been much panic among the Amorites if they could not clearly see their attackers.
Alternatively, Joshua’s request could have been for the provision of extra sunlight so that the daylight hours would be prolonged. This seems to be the natural way to understand Joshua 10:13.2
12 At that time Joshua spoke to the LORD in the day when the LORD gave the Amorites over to the sons of Israel, and he said in the sight of Israel, “Sun, stand still at Gibeon, and moon, in the Valley of Aijalon.”