There is no mythological story behind Lakshmana possessing any special power. He just prayed to the devatas after drawing the line and establishing Sitaji in their care. He said that the consequences of crossing the line would be that the said person’s head would get destroyed and make powder i.e. burn and become ash.
The story as described in the Telugu Ranganatha Ramayana:
After this, Lakshamana drew seven lines around the thatched hut and said, ”Oh mother, do not cross these lines and come outside. If anyone tries to cross these lines his head will become powder that very instant.” Then he prayed to Agni establishing Sitaji in his care, bowed down respectfully to Sitaji and left to find Ramaji.
-Ranganatha Ramayana Aranyakanda Chapter 18
The story is the same even in the Bengali Krittibas Ramayana with a minor variation on the number of lines, not specifically mentioning Agni and not mentioning the consequences:
Going out, Lakshmana drew a line all around and said no one shall enter the hut. He said, “Oh devatas, Raghunatha his Vishnu himself and his wife is Sita. Please keep her.”
-Sri Rama Panchali Aranya Kanda 32