In space, microgravity makes everything feel weightless and everything just floats around.
As you can well imagine, the weightlessness makes going to the bathroom somewhat of an engineering feat. Astronauts can't use a toilet to go to the bathroom like we can here on Earth due to the lack of gravity. Any water that would be in the toilet in space would just float out of the toilet and render the toilet ineffective at flushing.
In this video, an International Space Station astronaut by the name of Samantha Cristoforetti demonstrates how a space toilet is used.
There are two main components; one for going number one, and one for going number two. Both rely on a vacuum created by fans to ensure that the human waste goes to the right place and doesn't just start floating around in space.
From there, human waste is dealt with accordingly.