So, what is the reason for saying «пошутил»? Is it just changing the verb to perfective aspect?
Yes, adding the prefix по- changes the aspect of the verb.
It's not "just" changing the aspect, though. Different prefixes give different shades of meanings to the verb, or even completely different meanings altogether. Пошутил, нашутил, перешутил are all perfective verbs with different meanings taking different arguments.
There is no universal rule that would say exactly what prefix means what. Same as in English words of Latin origin like "compose, impose, expose, transpose, depose" etc, adding different prefixes to the same basic root spawns a plethora of different meanings, only vaguely, at best, related to each other and to the original root. You'll have to learn them separately.
If so, does that apply to all verbs?
In many cases, по- is the "default", so to speak, prefix, which is used when you need to put an unprefixed imperfective verb into the future tense without changing its basic meaning.
However, it doesn't work with all verbs (and, probably, not even with most verbs). The "default" perfective form can also be formed by suffixes (решить/решать), suppletion (говорить/сказать), other prefixes (писать/написать) or even, in the case of the so-called biaspectual verbs, by not changing the verb at all (женить, велеть, обещать).
In general, adding prefixes to imperfective verbs does make them perfective.
There is a class of iterative verbs formed with suffixes -ива, -ыва (шучивать, говаривать, глаживать etc.), which remain imperfective when prefixes are added to them. In fact, these suffixes are used to form imperfective forms back from perfective, and they don't keep the iterative meaning.
There is another class of verbs, called iterative verbs of motion (моторно-кратные): ходить, возить, носить etc.
When prefixed, they can form imperfective verbs too.
Sometimes, these prefixed forms have perfective homonyms or homoforms only differing in stress: заходить "start walking" perf., "visit, drop in" imperf.; выноси́ть "bring out" or "endure" imperf. / вы́носить "carry (a child in pregnancy)" perf, etc.