599. Starting a Labor Before Shabbos
Shabbos 2:25
If Jews have cause to wage war against a non-Jewish city, the siege should commence at least three days before Shabbos. War may then be waged on any day, even on Shabbos, until the city is conquered; this is true even for a voluntary war. The Midrash understands “until you have conquered it” (Deut. 20:20) to include battle on Shabbos. This is certainly the case with an obligatory war; for example, Joshua conquered Jericho on Shabbos.
Shabbos 3:1
One may begin an act of labor on Friday even though the act will complete itself automatically on Shabbos. This is because the prohibition against performing acts of labor only applies on Shabbos itself. Not only that, if a labor completes itself automatically on Shabbos, we are allowed to derive benefit from what happened on Shabbos. (Examples are provided in the next halachos.)