The saying originated in medieval times before the invention of indoor plumbing. People used a chamber pot as an indoor toilet and then dumped the contents into the street later, a common practice in London. Only the very poor would not have a pot to piss in. We still use the expression today to refer to someone who is extremely poor. Unfortunately, this expression is a reality for all too many people in our world.
This reality is especially hard on women and girls. The Water Supply & Sanitation Collaborative Council says:
"Lacking toilets in overcrowded slums means going the whole day without relieving oneself and then risking exposure—or even assault— at night, a humiliating daily routine that can damage health. Menstruation adds considerably to the need for sanitary facilities. Sexual harassment and rape are also a risk in rural areas, where women often seek privacy in the darkness, and in refugee camps, which all too often fail to provide safely located, women-only toilets. These realities absorb women’s time, imperil their physical well-being, and limit their free and equal participation in the economic and social life of their societies."