Looks to me like it is the BMW cable lock for locking the whole bike up. It was stored in the backbone of the frame, so when you pull the tool tray, you might see the cable poking out of that frame tube.
The only things holding the battery tight are the rubber tie down straps. The box will hold the battery without those straps... the battery will just vibrate.
There is no security concern for somebody taking your battery since you can lock the seat and need to open the seat to take out the battery.