If you use the option Method -> "KernelDensityEstimation" in LearnDistribution, then the estimated bandwidth can be extracted. Call that value bw. (And I'm assuming that a Gaussian kernel will be used.)
(* Generate some data *)
SeedRandom[12345];
data = RandomVariate[NormalDistribution[0, 1], 100]
(* Use LearnDistribution *)
ld = LearnDistribution[data, Method -> "KernelDensityEstimation"]
Based on the answer from @MarcoB one can obtain the bandwidth of the Gaussian kernel with
bw = First[ld]["Model", "KernelSize"]
(* 0.510338 *)
Now armed with the bandwidth (i.e., "KernelSize") to obtain a random sample from that estimated distribution one first randomly selects an observation from the original data. Then select a random sample from a normal distribution with a mean of the random observation and a standard deviation of bw. (Or equivalently, select a random sample from a normal distribution with mean 0 and standard deviation bw and then add in a random selection from the original data.)
RandomVariate[NormalDistribution[data[[RandomInteger[{1, Length[data]}]]], bw]]
It might even make more sense to write code in the external application that just uses the data, the estimated bandwidth, and whatever random functions are available especially if multiple random samples are contemplated.
I'll ignore the use of Compile (another subject I know little about).
For a much, much better description of this process see @whuber's answer at CrossValidated.
LearnedDistributiona kernel density distribution? If so, getting the pieces to obtain random samples in an external program should be relatively straightforward. – JimB Mar 25 '21 at 21:49