Whether or not allowed and whether or not safe is essentially the one issue. That is, if 'safe' they are allowed and if 'unsafe' they are disallowed.
Safety here (as usual!) is somewhat subjective† (eg say a controlled drug) but for aerosol cans is more a matter off flammability than pressure. As mentioned by @Mark Mayo most large passenger plane cargo holds are pressurized, even if not to pressure at ground level. For an example of subjective, most airlines deem liquid volumes over 100ml 'unsafe' even though exactly the same liquid in a smaller quantity is deemed 'safe'.
For flammability, there are two aspects: 1) the content and 2) the propellant.
As mentioned by @Nat Eldredge, some content is allowed and some not. For US domestic flights a place to check is TSA's site as he suggested. There may be some items that are disallowed despite not being flammable (and therefore in reality 'safe') on the 'subjective' basis that the majority of such items are flammable (eg perhaps water-based spray paint) - it is simply not practical to cover every single possible item that someone might want to transport, so a 'broad brush' approach has to be taken.
Propellants are usually flammable but when used for toiletries are normally in small quantity, hence allowed as for small quantities of most liquids.
† TSA governs USA, EASA the EU and IATA 'fills in the gaps'. The wording at least of each differs, hence the scope for interpretation differs, hence back to an element of 'subjectivity'.