There isn't really a good way for #right to match whatever #left has become. The best way to do this is probably:
<div id="wrapper">
<div id="right"></div> <!-- note that right comes before left -->
<div id="left"></div>
</div>
Then have this style:
#left, #right {
width: 50%; /* Adjust as needed */
#right {
float: right;
}
This way, #right won't affect the page length but #left always will. However, #right still won't stretch to the length of #left. I don't know what reason you have for it needed to stretch to #left, but I assume it's something cosmetic. I would either try to apply it from #left or from #wrapper instead if you want it to repeat all the way down.
For example, if you want the #left white and #right red:
#left {
background: #fff;
}
#wrapper {
background: #f00;
}