A probabilistic program and a Bayesian Network are both ways of specifying probabilistic models. Any model that can be specified as a Bayesian Network can also be specified by a probabilistic program, in fact by a probabilistic program that has no control flow. Roughly
Bayes Nets == Straight line Probabilistic Programs
For example consider the Bayes Net
This Bayes Net is equivalent to the probabilistic program (in Pyro)
def model():
    p_rain = pyro.param("p_rain", torch.tensor(0.2), constraint=unit_interval)
    p_sprinkler = pyro.param("p_sprinkler", torch.tensor([0.4, 0.01]),
                             constraint=unit_interval)
    p_wet = pyro.param("p_wet", torch.tensor([[0.0, 0.9], [0.8, 0.99]]),
                       constraint=unit_interval)
    rain = pyro.sample("rain", Bernoulli(p_rain))
    sprinkler = pyro.sample("sprinkler",
                            Bernoulli(p_sprinkler[rain.long()]))
    wet = pyro.sample("wet", Bernoulli(p_wet[rain.long(), sprinkler.long()]))
More generally, probabilistic programs can contain control flow (if, for, while) and recursion. Some of these extra features are expressed in extensions to Bayes nets, e.g. some for loops can be expressed as plates in Bayes Nets.