Another tidbit for those coming from the acoustic world and wondering why all the bother...
This is about audio to digital (A/D) and digital to audio (D/A) converters (DAC or audio interface is the name of the tech.)
Your computer has a DAC. However, when i got into this ten+ years ago, I read that the DAC in the computer (I was using an iMac at the time, now using a Mac Mini) was of lesser quality AND, when recording, put a load on your computer processor that caused issues when using Mainstage or Logic Pro.
This issue (lesser DAC quality, computer processing load) could be addressed by using an external audio interface. At the time, and probably still, Focusrite Scarlett was the go to. Apogee touted its Duet product as compatible with an iPad (WOW!) which was a selling point for me (envisioning just having an iPad + that small unit to record my mandolin duet!!!)
If your digital piano has a MIDI interface and can produce the piano sounds from Mainstage using Apple's studio pianos or various third party "software instruments" it has a DAC that accepts external digital audio input and converts the digital audio produced by Mainstage+software instruments to an analog signal for your internal speakers. It already converts the digital stuff produced by your keyboard's system...
In all probability, you don't need an audio interface in the typical home setup because your digital piano has internal speakers. Stage pianos like Roland's RD-2000 and similar don't have internal speakers and aren't set up to accept microphone input. So this is when an external audio interface comes into the picture. And, if you're sharing your studio monitor speakers for music production AND day to day computing sound output...there are setup options.