The device is outfitted with oxygen ports and a nose cone to protect it from impact with rocks.
Musk says the sub would be light enough to be carried by two divers and small enough to get through narrow cave gaps.
Hours after four boys were confirmed to have been rescued from the cave, Musk tweeted video of a small vessel being tested underwater.
The video shows people in scuba gear pushing and pulling the equipment across a pool in Los Angeles.
In one of the videos of testing that Musk put on Twitter, a man can be seen emerging from the metallic cylinder.
"With some mods, this could also work as an escape pod in space," Musk said.
Musk said on Twitter the aluminum sub would be tested until Sunday midafternoon California time before being placed on a 17-hour flight to Thailand.
But Saturday night, he tweeted that the cave was now closed for the rescue by divers.
"Will continue testing in LA in case needed later or somewhere else in the future," he wrote.
The California tunnel company run by Musk is continuing to maintain a presence at the Thai cave where several boys and their soccer coach are awaiting rescue.
A spokesman for Boring Co. said on Sunday that the company has four engineers who are "offering support in any way the government deems useful."
His news of creating an escape pod came after US and Thai officials got four boys out of the flooded cave network after spending 15 days trapped along with their soccer coach. They were escorted out by a group of Thai and international divers.
Eight boys and the coach remain trapped, and experts are hoping to free the rest of the boys today.