How soon do you know if a kidney has been rejected by the body?

Immediately. A rejected organ can cause pain, swelling, fever, and a drop in urine output. Early in the rejection process, there are no symptoms which is why lifelong supervison by transplant doctors is required to optimize graft survival.
No absolute time. Not all grafts are rejected and lost. If the kidney function deteriorates the best way to tell if it is being rejected is to biopsy the graft and look the kidney tissue under the microscope. Most acute rejection episodes occur the first three months after the transplant, but they could occur at any time; especially if the anti-rejeciton medications are interrupted for any reason.