The Magnetosphere is the region of space surrounding a celestial object that is affected by the object's magnetic field.
The Earth's magnetosphere is thought to be generated by its rotating iron core. This is commonly referred to as a Dynamo. In order for a planetary core to act as as a dynamo it must contain a rotating liquid metal and there must be convection. Current theory is that the core of Mars has cooled enough to solidify or become plastic, but seismic investigations will be required to confirm or disprove this conclusion.
When molten rocks with iron or other magnetic materials cool, while they are in a magnetic field, that field is frozen into the rock. This is known as paleomagnetism. This has been discovered on Mars, which is proof that Mars had a strong magnetic field early in its history. The fossilized magnetic field is stronger than expected, and runs in stripes in the Southern Hemisphere which is evidence that there may have been plate tectonics at some time in Mars history. 
Mars at one time had a thicker atmosphere. The decline in Mars' Magnetosphere is considered to be a contributing factor to Mars' atmospheric loss, and is estimated to be responsible for about 1/3 of the decline in air pressure.
A magnetosphere of sufficient strength will help to protect the occupants of a planet from the harmful solar wind and radiation of their star and (to a lesser extent) the surrounding cosmos. Many say that because Mars lacks a significant magnetic field, its magnetosphere offers negligible protection from solar wind and ionizing radiation. This is an oversimplification. The dangerous radiation in space is made up of high energy electromagnetic waves (such as x-rays & gamma rays), and ionizing radiation made up of the solar wind, and cosmic rays. These classes are discussed below.
Electromagnetic radiation such as x-rays are not effected by magnetic fields. On Earth our thick atmosphere pretty much stops these waves since it is opaque to x-rays and gamma rays. (If Superman had x-ray vision he couldn't see anything, because there are almost no x-rays at Earth's surface. He would be in total x-ray darkness.) On Mars, most of these get thru the thin air, and add to the radiation dose taken on Mars.
The solar wind particles (mostly protons, electrons and helium nuclei) are swept up by the Earth's magnetosphere forming the Van Allen Belts. They take a spiral path, until they hit the Earth's atmosphere over the north or south polar regions, forming the aurorae. However, Eskimo are not constantly dying of radiation poisoning. The thick Earth's atmosphere completely protects life from these electrons, protons, and alpha particles. These VanAllen Belts are a concern to space travellers moving thru them; either a path should be picked that avoids the worst of them, or they should be traveled thru quickly, to minimize the radiation exposure.
Cosmic rays are charged particles, protons, helium nuclei, and ~1% heavier nuclei that are accelerated to tremendous speeds, close to that of the speed of light, by poorly understood processes deep in space. They are found everywhere in space moving in all directions. Though they are deflected by magnetic fields, they are only deflected slightly since they are moving so quickly. (The lowest energy cosmic rays are more strongly effected. The rest of this discussion will concentrate on medium and high energy cosmic rays.) For example: on Earth, a cosmic ray from deep space is heading towards you. The Earth's magnetic field deflects it (say) 10 meters to the west. That sounds great, except that cosmic rays that would have missed you 10 meters to the east are deflected into you. Normally, the principle particle of a cosmic ray hits some atom in the Earth's atmosphere and explodes into a shower of secondary particles. Some are charged, and thus are affected by the magnetic field, and some uncharged, which ignore the magnetic field. However, these secondary charged particles are also slightly deflected, just as described above. Airline pilots and people living on mountains have less air above them, and thus receive significantly higher levels of cosmic rays. A Norwegian study measured the high energy cosmic ray dose at sea level from the south of the country and at the north, which is much closer to the Earth's magnetic pole. They found no difference between the cosmic ray doses. Finally, scientists who wish to conduct experiments away from cosmic rays do not make a magnetic bubble. A cosmic ray that can get thru the sun's magnetic field, and the Earth's magnetic field, is not going to be deflected by a tiny magnet close to the Earth's surface. Scientists go deep underground, down mine shafts, to avoid cosmic rays.
Note that the highest energy solar particles and the lowest energy cosmic rays have similar energies. So the lowest energy cosmic rays can be treated like solar radiation. (Which is good, since they can be shielded against.)
Non-ionizing radiation is not effected by magnetic fields. A Martian magnetic field would protect against the solar wind, but have very little effect against the high energy cosmic rays. The key protection against ionizing radiation from space will be mass, either the air above you, sandbags, water, plastics, or other radiation shielding built into your habitat. The cosmic ray dose on Mars' surface will be half of what it is in deep space (Mars' mass blocks out half the sky), but no reasonable amount of shielding (and no tiny magnetic bubble) will block them. This cosmic ray dose will simply be taken by Mars explorers during their couple year long mission. Mars settlers will likely spend much of their time in habitats with thick shielding, or simply accept the higher yearly radiation dose. If Mars is terraformed the thicker atmosphere will reduce cosmic ray doses, and pretty much stop completely the solar wind particles.
A magnetic shield could be included in a habitat to direct solar wind particles (during a coronal mass ejection) into the ground some distance away from the habitat, but adding shielding made out of local dirt or water may be better. See Radiation.
It has been suggested that it may be worthwhile to give Mars an artificial magnetic field, and thus a magnetosphere, by placing a large magnet at Sol-Mars L1 point, or by putting a superconducting loop around the planet. The L1 orbit is unstable and the slightest deviation from this ideal location will result in the magnet drifting off into solar orbit independent of Mars. With the solar wind pushing against the magnet, it will be constantly deviated away from this ideal spot. Thus, significant mass would be required constantly for station keeping. In 2021 April 8, published in the International Journal of Astrobiology, Marcus DuPont and Jeremiah W. Murphy studied these two options. They found that fundamental physical constraints and the amount of materials needed made a superconducting loop around the equator more practical. 
- https://sci.esa.int/web/mars-express/-/31028-martian-interior?fbodylongid=645 - Paleomagnetism discovered on Mars.