Heat oil in a large skillet over medium heat. Cook and stir onions in hot oil until softened, 5 to 10 minutes. Stir in rosemary and black pepper; transfer mixture to a slow cooker. Pour vegetable stock, butternut squash, and apples into slow cooker.
Cook on Low for 8 hours (or cook on High for 4 hours).
Set oven rack about 6 inches from the heat source and preheat the oven's broiler.
Puree soup using an immersion blender until smooth. Alternately, puree soup in batches in a food processor until smooth. Season with salt. Ladle soup into oven-safe bowls and sprinkle Swiss cheese and walnuts over the top.
Cook soup under the preheated broiler until cheese is hot and bubbling, 1 to 2 minutes.