The focus of the closed-door get together was "innovation," according to a Defense Department spokesman, although Musk is also looking to win more government business for SpaceX, which launches satellites into orbit.
Neither Carter nor Musk spoke to reporters after their meeting, but Defense Department spokesman Peter Cook said Monday that Carter "has been reaching out to a number of members of the technology community to get their ideas, their feedback, find out what's going on in the world of innovation."
Musk tweeted Thursday about the visit and included a reference to the Marvel Comics' Iron Man character. He is thought to have partly inspired that character in the 2008 "Iron Man" film.
When asked by CNN's Barbara Starr if Musk's role as a defense contractor would complicate the meeting with Carter, Cook said: "The secretary knows very well the rules and regulations required, and how to keep those issues separate and apart and transparent."
Carter has focused intensely on promoting links between the Department and technology companies from the private sector, making a number of trips to Silicon Valley and establishing the Defense Innovation Unit Experimental (DIUX) in Silicon Valley and Boston.
Speaking in San Francisco in March, Carter said DIUX centers would allow the Pentagon "to better tap into the region's innovation ecosystem and build relationships with local companies."
He said one of his goals as secretary "has been to build and in some cases to rebuild the bridges between the Pentagon and America's wonderfully innovative and strong technology community."
The Pentagon is also inviting certain approved hackers to test the department's cybersecurity as part of its "Hack the Pentagon" initiative. According to Cook, the "controlled" pilot project will offer "bounties" to hackers who can identify and improve the Department's cyber vulnerabilities, a practice that is common in the private sector.
Musk is already playing a role in the defense industrial complex. His private space exploration company, SpaceX, has been actively competing for military contracts, seeking to provide rocket launch services to get military satellites into space.
The process of awarding the contracts has been at the center of a contentious fight on Capitol Hill.
SpaceX sued the Air Force in 2014 over what is said was an unfair process for competing for satellite launches before it was certified for military space launches in 2015.
The company successfully landed part of its Falcon 9 rocket on a drone ship in April. SpaceX's landing could lead to possibilities of the company reusing rockets for future launches, potentially saving money and even time. Musk tweeted Tuesday
that he hopes to reuse a space rocket this fall.
In April, SpaceX was awarded
its first $82.7 million contract to launch the Air Force's next generation GPS satellite in 2018.
The only other certified launch provider is the United Launch Alliance, a joint venture between Lockheed Martin and Boeing. ULA's Atlas space rocket uses Russian-made rocket engines.
Chairman of the Senate Armed Services Committee Sen. John McCain has slammed the Air Force and Department of Defense for continuing to rely on a space rocket that uses Russian-made engines.
During a January committee hearing, McCain charged that the use of Russian RD-180 rocket engines meant that the U.S. is "giving tens of millions of dollars to corrupt oligarchs." McCain also said the Russian company that manufactures the engines is overseen by board members that were placed under sanctions in the wake of the Russian armed annexation of Crimea in 2014.
"They are a bunch of thugs and cronies of Vladimir Putin, some of them are ex-KGB," McCain told CNN's Wolf Blitzer, referring to the board members in question.
But the Air Force and the Pentagon have been reluctant to completely stop purchasing the Russian engines, fearing that doing so would make ULA uncompetitive and leave SpaceX with a monopoly over military space launches.