I am assuming your pipeline is that you are running an EKF SLAM algorithm over some data to estimate a set of initial poses and landmarks, and then you feed all of these states into a global bundle adjustment.
In particular the covariance matrix gives you a confidence on location
but global bundle adjustment does not.
First things first is that the global bundle adjustment algorithm does give you the confidence of the states(poses, and landmarks). It is just called something different typically the Hessian or more commonly the Information Matrix($I$). The Information Matrix is just the matrix inverse of the covariance matrix and vice versa. So if you are more comfortable in working with the covariance matrix($C$) then you can just do that operation first.
$$ C = I^{-1}$$
This page for Ceres which is commonly used to solve bundle adjustment problems has a good description of how to extract the covariance.
If you want to do it manually you need to compute your Jacobians($J$), form the Hessian($H$), and then invert it to get the covariance.
$$ C = (J^T*J)^{-1} = H^{-1} $$
How do you use the confidences when running global bundle adjustment?
This is actually kind of difficult to do and very much depends on how you want your EKF algorithm to interact with your Bundle adjustment algorithm. I would say the general approach people do is ignore the EKF covariances for your pose and landmarks. Instead your measurements/factors(e.g the reprojection error) each have their own uncertainty just like in the EKF. And your global bundle adjustment uncertainty would come from those.
If you really want to apply the uncertainty from your EKF algorithm then you would instead set a prior measurement/factor on each pose/landmark and you would set the measurement uncertainty to be equal to the EKF's uncertainty.