The simplest answer to your question is when the pain becomes debilitating, and you have exhausted all conservate care options including Physical Therapy. A lot of times people find success with Physical Therapy alone or in conjunction with cortisone injections to manage the pain. However, depending on your age and the severity of the knee osteoarthritis, conservative care may not be a long-term viable solution for you. I have even seen patients do preventative knee replacements as they approach mid-late 80s as surgery becomes inappropriate beyond a certain point. But, besides that exception, total knee replacements are a last resort after other options have proven unsuccessful.
The caveat to the above is that if you are having knee pain from osteoarthritis and have decided to get a total knee replacement, it is still highly recommended to receive Physical Therapy in advance of the procedure—in the PT world we call this ‘Pre-hab’. This will greatly improve your outcome and likely reduce the duration of your rehabilitation. The reason being that your PT will help address your ‘pre-existing’ strength deficits, flexibility impairments, and/or movement faults. This will ensure you have the best result possible.