How do I programmatically insert the entity ID?
Why don't you use a module providing this functionality, like profile2 ?

The user is not created in your submithandler, so either you save it:

function foo_user_register_form_submit($form, &amp;$form_state){
    $edit = array(
          'name' =&gt; $form_state['values']['name'], 
          'pass' =&gt; user_password(),
          'mail' =&gt; $form_state['values']['mail'],
          'init' =&gt; $form_state['values']['mail'], 
          'status' =&gt; 1, 
          'access' =&gt; REQUEST_TIME,
          'field_first_name' =&gt; array(LANGUAGE_NONE =&gt; array(array('value' =&gt; $form_state['values']['field_first_name']))),
    );
    user_save(drupal_anonymous_user(), $edit);
}


For more details see the docs.

Or you could try to add a custom submit handler, which would be fired after the user is created, in form_alter:

$form['#submit'][] = 'your_custom_submit_handler_function';


In there the user should already be created. so:

function your_custom_submit_handler_function(&amp;$form, &amp;$form_state)
    {
        $fe_id = db_insert('field_revision_field_first_name')
        -&gt;fields(array(
            'field_first_name_value' =&gt; $form_state['values']['field_first_name'],
            ))-&gt;execute();
        drupal_set_message(t('your form entry has been added'));
    }



  But keep in mind, that this custom inserting maybe needs some more
  code, here you only add the revision entry ..