You can try the below code to update the theme on runtime in Magento 2.
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$objectManager->get(\Magento\Framework\View\DesignInterface::class)->setDesignTheme('Magento/luma', 'frontend'); //where Magento/luma is the theme name.
However, you can use the dependency injection in your custom module instead of the $objectManager
.
EDIT:
app/code/Vendor/Module/etc/events.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="layout_load_before">
<observer name="layout_load_before_custom" instance="Verndor\ModuleName\Observer\ChangeTheme" />
</event>
</config>
Hope it will help!!!