Rendezvous and Docking
Here is an ESA documentary on how crews flying the Russian Soyuz spacecraft get to the ISS using what is called Rendezvous and Docking
Soyuz rendezvous and docking explained
Soyuz has a toilet in its habitation module.
Rendezvous is carried out in two distinct parts followed by an automated docking to the ISS
The Phasing orbit
Bielliptic Transfer
Docking
The SpaceX Crew Dragon and also Boeing's Starliner will also use similar rendezvous and docking profiles