You can't put a url in the history that the user hadn't traveled too. What replace does is allows you to avoid putting your own history in. I believe the way it works is like this.
Suppose your history was
and the went to your site. Then the user clicks on a button on your site that does
location.href = "www.msn.com";
sends them to www.msn.com
so the history would look like
But if instead the button did
location.replace("www.msn.com") then the history would look like
So the function replaces your spot in the url history with the one you want to go to. I believe one design theory for using it is when you have a page and all it does is forward you to another page (like after a post message). It can make a more appropriate user history conforming to what the user would expect instead of what actually happened.
I've never used it myself so it's possible there are more restrictions on its use.