Depends on where the alternator is connected and how the battery switch is wired and used.
A pretty standard wiring connection is Alternator to Starter to 1-2-B Battery Switch to House or Start Batteries (depending on switch position). If your boat is wired this way
and when you run the engine with the battery switch in the
Both position, then it doesn't matter much to which battery the windlass is connected. If you do not do this, then it matters quite a bit.
To state this in another way, the windlass should be connected to the same battery as the alternator output is connected. To avoid voltage drop the engine and therefore the alternator should be running. If either battery is not fully charged (
unlikely for a house battery in the morning) when the windlass motor is engaged there can be a significant voltage drop which is not good for the windlass motor, not to mention it will slow down the anchor retrieval. The alternator output prevents this voltage drop.
Edit: See the strike through. Proof reading is not my strong suit.