Shortly after dawn, as the sun rises over the hills behind the city, tens of thousands of women will wake in the Saudi Arabian port of Jeddah and go to work. Maybe 14 or 16 hours later, their day will be over.

They are maids, almost all from the Philippines or Indonesia, working for £100-£200 a month. There are more than 500,000 of them in Saudi Arabia, among nearly nine million foreign workers who sweep roads, clean offices, staff coffee shops, drive the cars that women are banned from driving and provide the manpower on the vast construction projects.

The story of the maids rarely receives attention, except when a new shocking incident reveals once again the problems many of them face. Last weekend a 54-year-old Indonesian maid was beheaded by sword for killing her female boss with a cleaver. Ruyati binti Sapubi had, an Islamic court heard, endured years of abuse before finally attacking her "madam", as the maids call their employers, when denied permission to return home.

Another Indonesian maid also faces execution for killing her boss whom she alleges tried to rape her. Other recent incidents include a Sri Lankan maid who had nails driven into her legs and arms by her employers, and another who was scalded with a hot iron.

Every year, thousands of the maids run away from their employers in Saudi Arabia.

Often physically or mentally scarred, they find themselves in a legal limbo. In Saudi Arabia, the consent of employers or "sponsors" is needed before any worker can leave the country.

Last week the Observer was able to visit a secret shelter in Jeddah – there are others elsewhere in Saudi Arabia – where 50 women are being looked after by well-wishers. The shelter is tolerated by local authorities, but the women who stay there, often for months on end, are not allowed to leave once they have entered and cannot use mobile phones. Sixteen sleep in a single room.

The maids say, however, that it is better than what they left behind. Most tell of fleeing employers who did not pay their wages; many talk of physical, mental or sexual abuse.

Rose, a 40-year-old from the island of Leyte, in the far south of the Phillipines, has spent five months in the shelter after fleeing from her employers after her "madam" threw keys into her face, narrowly missing an eye. "I don't know why she did it. She lost her temper," said Rose, whose wages were consistently in arrears.

Many exist in an illegal netherworld in the sprawling city itself. Muneera, a 33-year-old from the Muslim south of the Philippines – from where many of the maids in deeply conservative Saudi Arabia come – told the Observer that she was sleeping on friends' floors after fleeing her employers. The family she worked for was "kind", Muneera said, but the hours were unbearable.

"I worked from 5am to 1am, almost every day. I got up to make the children breakfast and get them ready to go to school and then cleaned the house all day, and in the evening my employers would go out and come back at midnight and want dinner. Finally it was just too much," she said.

Beth Medina, a 46-year-old maid, said she ran away after two months. "I had no idea what it was going to be like. If there was a single hair on the floor, madam was angry at me. The only food I got was leftovers from their dinner. If there wasn't any, I got bread," she told the Observer.

Few of the maids, who are often recruited by agencies in the Philippines, have much idea about where they are going or what will be expected of them. Terms of employment are also variable. As domestic workers, they are not protected by Saudi labour law.

Riyadh recently rejected demands from Manila for medical insurance for maids and for information on employers to be supplied before their departure. For their part, Philippine officials refused to accept a cut in the minimum wage for maids from $400 a month to $200. The result is a moratorium on the hiring of maids. Indonesia has also stopped its citizens travelling to Saudi Arabia following the execution last week.

Yet the governments are likely to come to some arrangement. There have been such standoffs before, and in relative terms the foreign workers generate huge sums of cash, most of which is sent to needy families at home and provides important revenues for developing nations. Saudi Arabia was the source of £17bn of such "remittances" last year, second only to the US. Entire states in some countries depend on the funds flowing in.

Money from the Gulf has transformed parts of India, particularly the Keralan coast, where many Muslims who work in Saudi Arabia live, for example. With such huge sums at stake, the plight of the odd "camel shepherd who dies unnoticed in the desert for a wage of $50 per week" is seen as unimportant, said Mohammed Iftikar, an Indian who works on behalf of foreign workers in Jeddah.

But the problems are growing. The number of foreign workers in the kingdom has been edging up, from a quarter of the total population a decade ago to nearly a third today. At the same time, youth unemployment in Saudi Arabia is approaching 30%.

The Saudi government is now trying to impose tight restrictions on the number of foreigners any company can hire and clamping down on long-term overseas workers.

"We have a young population. We need to generate 6.5 million jobs. At the moment we have jobs that people don't like to do. So either we create jobs that people like, or we try to convince people to accept the jobs that are available," Dr Abdul Wahid bin Khalid al-Humaid, the vice-minister of labour, told the Observer in an interview in Riyadh last week. Analysts say it is unlikely, however, that Saudis will replace the foreigners soon.

Many foreign workers arrive illegally, smuggled in from Qatar, Kuwait or Yemen. There are estimated to be tens of thousands of "absconders" – as those who have run away from the jobs for which their residence permits were issued are called – from Nepal alone. And the wealth of Saudi Arabia, where the per capita GDP is more than £15,000, continues to attract more people.

Many workers both enjoy their time in Saudi Arabia and are grateful for the opportunity employment there gives them. Their example encourages others to travel too.

Eileen, a 44-year-old maid from Iloilo in the Philippines, said her employers always paid her monthly wage of £400 on time and even "invited [her] to eat with them sometimes". Though she gets up at 5.30am and works until late in the evening, she has some time off in the day and each summer travels with the family on holiday to Europe.

With the money she earns, Eileen supports the four children of her brother, who died in a car accident last year. "Maybe I am lucky," she said.

One result of the huge foreign population is a cosmopolitanism that lightens the otherwise severe and puritanical atmosphere in Saudi Arabia. Every major city has its "immigrant quarter", where people from a score or more countries fill cheap restaurants serving food from across Asia and further afield or simply sit on street corners where a dozen different languages can be heard.

In Jeddah, it is the old city, Balad. On a Friday night, its car-choked streets were full of Filipino care workers in embroidered headscarves bringing colour to their obligatory black, Saudi-style, abbaya gowns; Indian labourers smoking enthusiastically; Sudanese teenagers earning a few riyals by washing windscreens; and Afghan children begging. Recent arrivals from central Africa collected cardboard packaging to sell for recycling. In the Selamat Datang cafe, Indonesian hotel workers downed traditional dishes from home – with rice, a bowl of soup and a Pepsi – for 14 riyal (£2.30).

For Rose, the maid stuck in the secret shelter, and Muneera, the runaway sleeping on friend's floors, such scenes hold little attraction. Their needs, they say, are simple. Muneera just needs a way out of the trap she has fallen into. She says she will go to the Philippine consulate and seek help.

Rose just wants an exit visa, the money for a flight home and enough cash left over to allow her three children to go back to school. "I hope I will go soon," she said.