There is no setting or existing module that will do this for you. I do not think it is a good idea to let two users share the same username, because there is so much in Drupal that depends on usernames being unique, and this will break if you make two usernames identical.
You do not tell us why you want to have this feature. However, if you are content with letting users authenticate using their email address (which is guaranteed to be unique), rather than their username, the Email registration module may solve your problem.
However, the Email registration module does not let the user pick his or her own username, but generates an unique username based upon the email address. I want my users to pick their own username, so I use a variant of Email registration that does this. It is named RealnameReg. It is a sandbox, but since it is based on Email registration it is stable. I am using it myself on several production sites.