You should inject class Magento\Store\Model\System\Store
in the constructor and declare a global variable.
E.g:
public function __construct(
//...,
Magento\Store\Model\System\Store $systemStore
) {
//...
$this->_systemStore = $systemStore;
}
protected function _prepareForm()
{
//...
$fieldset->addField(
'store_ids',
'multiselect',
[
'name' => 'store_ids[]',
'label' => __('Store Views'),
'title' => __('Store Views'),
'required' => true,
'values' => $this->_systemStore->getStoreValuesForForm(false, true),
]
);
}
I hope it was helpful.