Heat vegetable oil in a saucepan and cook onion until softened. Add garlic and rosemary and cook 1 minute more. Stir in the barley until well coated. Add the stock and heat to a simmer.
Place the cubed sweet potato in the slow cooker and top with the barley mixture. Stir well.
Cover and cook on Low for 8 hours or High for 4 hours, until barley is very tender.