Sterilize jars and lids: Wash 6 (1 pint) jars, lids, and screw bands in hot soapy water, then rinse well. Dry screw bands. Put jars and lids on a rack in a boiling-water canner or an 8- to 10-quart deep pot and add enough water to cover by 2 inches. Heat water until an instant-read thermometer registers 180 degrees. Do not let boil. Keep jars submerged in hot water, covered, until ready to use.
Cook onions in a large pot of boiling water until almost tender, about 5 minutes. Transfer with a slotted spoon to a bowl, reserving cooking water. When cool enough to handle, trim root ends from onions, keeping onions intact, then slip off skins. Halve onions lengthwise.
Add beets to water in pot and boil until almost tender, about 25 minutes. Drain and, when cool enough to handle, slip off stems and skins. Halve beets lengthwise (quarter if large).
Bring vinegar, syrup, water, salt, star anise, and ginger to a boil in a 3-quart saucepan, then simmer, uncovered, 10 minutes.
Drain jars upside down on a clean kitchen towel 1 minute, then invert. Fill jars with beets and onions. Remove star anise and ginger slices from pickling liquid and tuck 1 of each into side of each jar. Fill jars with pickling liquid, leaving 1/4-inch of space at top, then run a thin knife between vegetables and jar to eliminate air bubbles.
Seal, process, and store filled jars: Wipe off rims of filled jars with a clean, damp kitchen towel, then firmly screw on lids with screw bands. Put sealed jars on a rack in a boiling-water canner or an 8- to 10-quart deep pot and add enough water to cover by 2 inches. Bring to a boil, covered. Boil for 20 minutes (for 1/2-pint jars), then transfer with tongs to a towel-lined surface to cool.
Jars will seal (if you hear a ping, that signals that the vacuum formed at the top of the jar has made the lid concave) and preserves will thicken as they cool. After jars have cooled 12 to 24 hours, press center of each lid to check that it's concave, then remove screw band and try to lift off lid with your fingertips. If you can't, the lid has a good seal.
Let beets and onions stand in jars at least 1 week for flavors to develop.
This recipe yields 6 (1-pint) jars.