Samuel was not allowed to sleep in the Holy of Holies, and he did not. The Bible says: “Samuel was lying down in the temple of the LORD, where the ark of God was” (1 Samuel 3:3).
Temple and tabernacle
The first issue here is the ‘temple’. Solomon built the temple, so there was no temple yet in the time of Samuel. The same word ‘temple’ however, is often used for the tabernacle. It refers to the Holy of Holies, to the Holy Place, and to the court around the tabernacle. Somewhere in this area, Samuel was sleeping. Obviously, that was not in the Holy of Holies, where only the high priest was allowed to enter once a year (Leviticus 16). It also was not in the Holy Place, since only priests were allowed to enter the Holy Place. God even said that other people entering the Holy Place would die (Numbers 18:21-22). Samuel slept somewhere in the court of the tabernacle.
God’s presence
The second issue is that this verse says “where the ark of God was”. It looks like Samuel sleeps next to the ark. But that is not what it actually says. It says that the ‘temple’ is where the ark of God was. So somewhere in the temple (or actually, the tabernacle), was the ark of God, and that was in the Holy of Holies. And somewhere in the tabernacle Samuel slept, and that was in the court outside the tent. The ark is specifically mentioned here because, as the most holy dwelling place of God, it prepares us for God’s special presence that we notice a few verses later. Samuel hears the voice of God, and in all probability this came from the direction of the ark.
Like Samuel, we should dwell in God’s presence, and ever be ready to hear his voice.