Barack Obama cautioned the need for commitment to democratic principles amid ongoing legal challenges faced by Donald Trump.