US authorities are calling it a case of ruthless human trafficking.
The alarm was raised when a man approached a Walmart employee asking for water.
The police were then called to what they've described as a horrible tragedy.
Inside a sweltering semi-trailer parked at a Walmart store in San Antonio, several people were found dead.
Dozens of others were rushed to nearby hospitals suffering from severe dehydration and other heat-related injuries.
San Antonio Fire Chief Charles Hood told CNN the conditions inside the truck were so extreme many victims will suffer irreversible brain damage.
"Some of them were severely overheated. That was a refrigerator truck with no refrigeration, so the inside of the truck was just austere conditions that no-one was going to survive. They were very fortunate they were found because if they were to spend another night in that environment, we'd have 38 people who would not have survived."
Investigators checked the store surveillance video which showed that other vehicles had arrived and picked up people from the truck before authorities arrived.
The truck driver, James Bradley from Florida, was arrested in connection with the incident.
San Antonio Police Chief William McManus says the serious crime will be thoroughly investigated.
"Checking the video from the store, we found that there were a number of vehicles that came in and picked up some of the folks in that trailer that survived the trip. We are looking at a human trafficking crime here."
San Antonio is about 240 kilometres north of the border with Mexico.
These women live near the Walmart and told local news organisation KENS 5 they were shocked by the events.
Woman 1: "[I was ] immediately saddened, because such a tragedy when they said there were children in there too. I just felt really sad because I know that these people were trying to come over here to live a better life."
Woman 2: "I can't imagine what those people were doing, what they were thinking, seeing people dying around them is just horrible. We've had immigrants in the past but nothing like this where people are dying right in our backyards."
In May 2003, 19 people being transported from South Texas to Houston died inside a truck due to heat-related injuries.
The US Border Patrol has reported at least four truck seizures this month around the area of Laredo in Texas.