FatalSleep's answer is right in saying that magic doesn't take the form of weapons, and is just thought particles called Psions. Magic sequences are only processed through CADs shaped like weapons. Why they are that shape is covered below:
First, it's important to understand the difference between a general and specialised CAD. This excerpt from the light novel covers it nicely:
"The two types of CAD are general and specialized. The general type placing a larger burden on the user but capable of a wide range of up to 99 activation sequences, while the specialized type is only able to contain up to nine activation sequences but possesses subsystems able to reduce the load on the user, making it possible to invoke magic faster."
Volume 1 - Enrollment I, Chapter 2
To add to those points, there's also a brief description of why certain specialised CADs take the shape of weaponry such as handguns and sniper rifles:
"By its nature, aggressive combat type magic sequences are generally stored in specialized CAD. [...] Specialized CAD are often shaped in the form of guns because using the auxiliary aiming systems incorporated in the area corresponding to the barrel, coordinate data is input at the moment the activation sequence is initiated"
Volume 1 - Enrollment I, Chapter 2
Put simply, the shape makes targeting easier - aiming the CAD helps determine the location of the desired target, rather than the Magic Technician having to supply all the coordinate data manually.
This is why it's some combat specialised CADs that take the form of guns - the majority of spells will be cast towards an opponent, which requires precise aiming. Such examples would be Tatsuya's Silverhorn Trident, Ichijou Masaki's CAD, and the CAD used by Saegusa Mayumi (below) in the Speed Shooting tournament at the NSC.