The question came up last year when Republicans floated the idea of pushing Trump into the role after Kevin McCarthy was voted out. Just as was the case with Trump, Musk could become speaker because you don’t actually need to be a House member to hold the position.
The U.S. Constitution’s only requirement for the speaker of the House is that the person is chosen by the House of Representatives. Thus, Musk could serve as the House speaker if he got the support and votes to do so.