How add conditional required field
So, if dont want to use conditional_fields module and only conditional fields core
You can do it, but required field have sometime a little bug.

In the issue someone take some code from conditional_fields that fix this issue, and use it. 

your_module/js/conditional_fields.js

(function ($, Drupal) {

// Fix core's required handling.
$(document).bind('state:required', function (e) {
  if (e.trigger) {
    var fields = $(e.target).find('input, select, textarea, fieldset');
    fields.each(function() {
      var label = 'label' + (this.id ? '[for=' + this.id + ']' : '');
      var $field_labels = $(e.target).find(label);
      var $fieldset_legends = $(e.target).find('legend span.fieldset-legend');
      var $labels = $field_labels.add($fieldset_legends);
      if (e.value) {
        $(this).attr({ required: 'required', 'aria-required': 'aria-required' });
        $labels.each(function() {
          $(this).addClass('js-form-required form-required');
        });
      } else {
        $(this).removeAttr('required aria-required');
        $labels.each(function() {
          $(this).removeClass('js-form-required form-required');
        });
      }
    })
  }
});

})(jQuery, Drupal);


In your_module.module in a form alter add: 

$form['#attached']['library'][] = 'your_module/conditional_fields';

$form['field_b']['#states'] = [
      'visible' =&gt; [
        ':input[name="field_a"]' =&gt; ['!value' =&gt; '_none']
      ],
      'required' =&gt; [
        ':input[name="field_a"]' =&gt; ['!value' =&gt; '_none'],
      ],
  ];


Don't forget add the js code in your_module.libraries.yml file

Adding JS to a Drupal module

With our above code it worked!.