Idea goes back to at least the 1970s
See here for the online version of the 1975 NASA document on the subject:
http://www.nas.nasa.gov/About/Education/SpaceSettlement/
And Heinlein had a lunar railgun used as a weapon, plus I think Arthur C. Clarke
talked about them back in the 1950s.
