US President Barack Obama says the motivation for a deadly shooting in California was not yet known, but a terror attack could not be ruled out.