Recent Scottish Government guidance includes mandatory use of face coverings on public transport. However, if you have a medical reason why wearing a face covering is not possible, then Transport Scotland clarifies that there is no requirement for any documentary evidence, so no need to ask your GP, for example, for a letter. The full guidance from Transport Scotland can be found here, but it’s a long read, so see the extract in italics below:
For children under 5 years of age or those with particular health conditions who cannot put on, wear or remove a face covering because of any physical or mental illness or impairment or disability or without severe distress an exemption applies. There is no requirement to obtain evidence in the form of a letter from a doctor or government that you are exempt. If you have a condition which means you cannot wear a face covering you need only advise if asked that you cannot wear a face covering because you are exempt for one of the reasons listed above.