I found the answer:

    /**
     * Implements hook_form_FORM_ID_alter().
     */
    function MODULE_form_comment_comment_form_alter(array &$form, FormStateInterface $form_state, $form_id) {
      $form['author']['name']['#required'] = TRUE;
    }