The main danger in a light aircraft is that the spray accidentally discharges in the cabin. That could temporarily blind and incapacitate the pilot, which would obviously be extremely dangerous.
According to an article from the Alaska Department of Fish and Game, GA operators typically take special precautions when transporting bear spray:
You can take bear spray, but you must tell the carrier and the pilot
must know. It requires special handling. Carl Ramseth is with Alaska
Seaplanes, a Southeast Alaska regional service, which has planes on
both floats and wheels. Bear spray is defined as a hazardous material,
he said.
“You can fly with it, but it needs to be declared,” he said. “We ask
passengers as they check in – people on scheduled flights as well as
people going to remote locations. People don’t realize it could be a
problem, so we always ask. There is paperwork filled out. We transport
it in a sealed can, stored in a part of the aircraft that is not in
the main cabin, so there is no risk of it going off in the cabin. Or
it goes in the float compartment of a float plane.”
Some carriers use a length of heavy duty black PVC sewer pipe, four
inches in diameter and threaded with caps at both ends. Several cans
can be stacked and sealed in the tube for transport.
Another article on the same site says that some operators don't want to carry it at all:
“Bear spray is a big one, it’s dangerous,” said Stewart of Skagway
Air. “We can do it, but we really prefer not to. Typically speaking,
most carriers won’t allow it. You don’t want that going off in an
aircraft.”
“We really try to have them leave it behind,” said Vanessa Thompson,
with 40-mile Air.
Even if you don't have a floatplane, as long as you have some duct tape it's still possible to carry the spray outside the cabin:
ilya_ktsn, CC BY 2.0, via Wikimedia Commons
It might look odd, but it's allowed by the FAA per JO 8400.34 - Fixed-Wing External Loads in Alaska:
Items in this group are small, lightweight, and temporarily attached
with bungee cords, straps, ropes, etc. Below is a list of items that
are examples that may be carried under a Standard Airworthiness
Certificate. For the purpose of this order, these
temporarily-attached items are not considered design changes or
alterations.
[...]
Cans of animal repellent, such as bear spray or pepper spray.